Skip to content

Feat: reuse persisted model and reasoning effort on thread resume#14888

Merged
shijie-oai merged 5 commits intomainfrom
shijie/cxa-1831-2
Mar 18, 2026
Merged

Feat: reuse persisted model and reasoning effort on thread resume#14888
shijie-oai merged 5 commits intomainfrom
shijie/cxa-1831-2

Conversation

@shijie-oai
Copy link
Collaborator

@shijie-oai shijie-oai commented Mar 17, 2026

Summary

This PR makes thread/resume reuse persisted thread model metadata when the caller does not explicitly override it.

Changes:

  • read persisted thread metadata from SQLite during thread/resume
  • reuse persisted model and model_reasoning_effort as resume-time defaults
  • fetch persisted metadata once and reuse it later in the resume response path
  • keep thread summary loading on the existing rollout path, while reusing persisted metadata when available
  • document the resume fallback behavior in the app-server README

Why

Before this change, resuming a thread without explicit overrides derived model and model_reasoning_effort from current config, which could drift from the thread’s last persisted values. That meant a resumed thread could report and run with different model settings than the ones it previously used.

Behavior

Precedence on thread/resume is now:

  1. explicit resume overrides
  2. persisted SQLite metadata for the thread
  3. normal config resolution for the resumed cwd

@shijie-oai shijie-oai changed the title Reuse persisted model and reasoning effort on thread resume Feat: reuse persisted model and reasoning effort on thread resume Mar 17, 2026
shijie-oai added a commit that referenced this pull request Mar 17, 2026
…14859)

### Summary
The goal is for us to get the latest turn model and reasoning effort on
thread/resume is no override is provided on the thread/resume func call.
This is the part 1 which we write the model and reasoning effort for a
thread to the sqlite db and there will be a followup PR to consume the
two new fields on thread/resume.

[part 2 PR is currently WIP](#14888)
and this one can be merged independently.
Base automatically changed from shijie/cxa-1831-1 to main March 17, 2026 17:14
@shijie-oai shijie-oai force-pushed the shijie/cxa-1831-2 branch 3 times, most recently from f4d512e to 7c7b5a8 Compare March 17, 2026 21:37
&response_history,
rollout_path.as_path(),
fallback_model_provider.as_str(),
persisted_resume_metadata.as_ref(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass down persisted_resume_metadata if available to avoid an additional db read.

@shijie-oai shijie-oai marked this pull request as ready for review March 17, 2026 21:40
Comment on lines +7527 to +7529
if has_model_resume_override(request_overrides.as_ref(), typesafe_overrides) {
return;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any override is detected, we not merged the persisted model settings.

To continue a stored session, call `thread/resume` with the `thread.id` you previously recorded. The response shape matches `thread/start`, and no additional notifications are emitted. You can also pass the same configuration overrides supported by `thread/start`, including `approvalsReviewer`:
To continue a stored session, call `thread/resume` with the `thread.id` you previously recorded. The response shape matches `thread/start`, and no additional notifications are emitted. You can also pass the same configuration overrides supported by `thread/start`, including `approvalsReviewer`.

When no model-related resume override is provided, resume reuses the latest persisted `model` and `reasoningEffort` values for that thread. Supplying any of `model`, `modelProvider`, `config.model`, or `config.model_reasoning_effort` disables that persisted fallback and uses the explicit overrides plus normal config resolution instead:
Copy link
Collaborator

@owenlin0 owenlin0 Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: codex language can be a bit robotic sounding haha

maybe something like this would be better

By default, resume uses the latest `model` and `reasoningEffort` values associated with the thread. Supplying any of...

@shijie-oai shijie-oai merged commit bb30432 into main Mar 18, 2026
33 checks passed
@shijie-oai shijie-oai deleted the shijie/cxa-1831-2 branch March 18, 2026 22:45
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants