fix(session): preserve agent identity across headless resume - #925
Open
breedx wants to merge 4 commits into
Open
fix(session): preserve agent identity across headless resume#925breedx wants to merge 4 commits into
breedx wants to merge 4 commits into
Conversation
…nflicting initialization
This was referenced Sep 8, 2026
Contributor
Author
|
The new resume regressions pass in upstream CI, but the full suite hits an existing midnight-sensitive session-browser assertion. I reproduced the same failure on unpatched
The CI test environment is Python 3.14.7 despite its 3.13 label; local controls were Python 3.13.13. Deprecation/resource/coroutine warnings were inspected, but not all CI warnings have independent base controls. The full suite is not claimed green. #926 remains a dependent draft awaiting #925 acceptance and subsequent requalification. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resuming a conversation in a fresh process currently gives the agent a new identity, even when its message history is restored. Persist identity with that history so headless runners and CLI resume continue the same agent, and reject conflicting explicit identities instead of silently switching ownership.
Related upstream work
set_message_historyresume path—not identity recovery from rendered prompt text or a single frontend.BaseAgent.idacross persisted histories; it does not equate that ID with every hook run/session ID or implement hook propagation.Change
ModelRequest.metadata, preserving unrelated metadata.set_message_history; a saved ID wins over a randomly generated process default, while a conflicting explicitly initialized ID fails before replacing active history./quick-resumeand/load_contexterror boundaries. The existing interactive picker error boundary is exercised too.The small
command_line/session_commands.pychange corrects existing load-error handling rather than adding a command. Given the plugin-first guidance, please flag a preferred supported seam before landing if this should be routed differently; the common history restore remains the authoritative identity boundary.Validation
Base
ce1fe372(0.0.827), Linux / Python 3.13.13, unchanged upstream dependency lock in a dedicated environment. Tests use disposable HOME/XDG and no inherited credentials; socket connect/DNS/bind is blocked, including in subprocess fixtures.test_open_project_and_select_sessionassertion requiringTODAY: the fixture subtracts one/two hours from the wall clock, so immediately after midnight both entries are correctly labeled yesterday. The exact failure reproduces on unpatched upstream. No tests were skipped or rewritten to hide it.Two stream-callback coroutine warnings and the CLI test's unawaited
maincoroutine reproduce on base. Quick-resume still invokes the existing deprecated autosave setter; this patch does not suppress its warning. This is scoped evidence, not a green full-suite or live-provider claim.Compatibility and boundaries
Existing metadata-free histories keep the current/default identity on first restore; after the next checkpoint, the identity is persisted. This deliberately does not infer an old identity from prose. It does not change session file names, formats, migration policy, retry custody, hooks, MCP behavior, dependencies or package versions. New metadata travels with the existing message-history serialization. No prompt-caching or measured cost-saving claim is made by the identity patch alone.