Skip to content

Conversation

@owenlin0
Copy link
Collaborator

@owenlin0 owenlin0 commented Jan 27, 2026

Overview

Currently calling thread/resume will always bump the thread's updated_at timestamp. This PR makes it the updated_at timestamp changes only if a turn is triggered.

Additonal context

What we typically do on resuming a thread is always writing “initial context” to the rollout file immediately. This initial context includes:

  • Developer instructions derived from sandbox/approval policy + cwd
  • Optional developer instructions (if provided)
  • Optional collaboration-mode instructions
  • Optional user instructions (if provided)
  • Environment context (cwd, shell, etc.)

This PR defers writing the “initial context” to the rollout file until the first turn/start, so we don't inadvertently bump the thread's updated_at timestamp until a turn is actually triggered.

This works even though both thread/resume and turn/start accept overrides (such as model, cwd, etc.) because the initial context is seeded from the effective TurnContext in memory, computed at turn/start time, after both sets of overrides have been applied.

NOTE: This is a very short-lived solution until we introduce sqlite. Then we can remove this.

@owenlin0 owenlin0 force-pushed the owen/resume_with_no_overrides branch from 68d3b8d to ed26d86 Compare January 27, 2026 00:28
@owenlin0 owenlin0 marked this pull request as ready for review January 27, 2026 00:34
@owenlin0
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@owenlin0 owenlin0 changed the title fix(app-server, core): dont write to rollout file if no config overri… fix(app-server, core): defer writing a resumed session's context to rollout file until a turn is triggered Jan 27, 2026
@owenlin0 owenlin0 changed the title fix(app-server, core): defer writing a resumed session's context to rollout file until a turn is triggered fix(app-server, core): defer writing a resumed session's context to rollout file Jan 27, 2026
@owenlin0 owenlin0 changed the title fix(app-server, core): defer writing a resumed session's context to rollout file fix(app-server, core): defer initial context write to rollout file until first turn Jan 27, 2026
@owenlin0
Copy link
Collaborator Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31590809ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2378 to +2380
let initial_context_seeded = sess.state.lock().await.initial_context_seeded;
if !initial_context_seeded {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Persist override updates when initial context isn't seeded

Because initial_context_seeded is set to false on resumed sessions, this early return skips recording any OverrideTurnContext update items. If a user resumes a thread, tweaks settings (e.g., cwd/approval/collaboration/personality), and then closes without starting a turn, those changes stay in memory only and are never written to the rollout, so they’re lost on the next resume and updated_at doesn’t reflect the modification. Previously overrides were persisted immediately, so this is a behavior regression for resumed threads.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

@owenlin0 owenlin0 Jan 27, 2026

Choose a reason for hiding this comment

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

that's fine for now

@owenlin0 owenlin0 merged commit fc0fd85 into main Jan 27, 2026
32 checks passed
@owenlin0 owenlin0 deleted the owen/resume_with_no_overrides branch January 27, 2026 18:41
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 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.

4 participants