fix(session-manager): let agents find and read archived sessions - #7128
Open
richard-fairthorne wants to merge 1 commit into
Open
fix(session-manager): let agents find and read archived sessions#7128richard-fairthorne wants to merge 1 commit into
richard-fairthorne wants to merge 1 commit into
Conversation
Agents could no longer find content in sessions the user archived from the UI. session_search silently skipped archived sessions with no way to opt in, so research done weeks ago simply stopped existing for the assistant. session_list had no way to show archived sessions either. session_search now scans archived sessions by default (matches marked [archived], active sessions always scanned first so archived ones never displace them from the scan window). session_list keeps its old default and gains include_archived: true to list archived sessions with the same marker. Fixes code-yeongyu#7125
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Fixes #7125
What changed
Agents lost access to knowledge the moment a user archived a session:
session_searchsilently skipped archived sessions (no opt-in existed) andsession_listcould not show them. This PR makes archived history discoverable again, following the approach recommended in the issue thread:session_searchincludes archived sessions by default (opt-out viainclude_archived: false). Search is a discovery operation; the caller is rarely the same agent that archived the session, so a default-off flag would not fix the failure mode.time.archived; archived ids are appended after active ids. Within the existingMAX_SESSIONS_TO_SCANbudget, archived sessions can never displace active ones, and every result findable before this change remains findable (strict superset).session_listkeeps its default (archived hidden, sidebar semantics) and gainsinclude_archived: trueto include them.[archived]provenance marker on hits and rows, so the calling agent knows restore semantics may apply.session_read/session_info(read path already fixed via the messages probe).Implementation notes:
getSdkAllSessions()now returns{ active, archived }partitioned client-side; the stable SDKSessiontype does not declaretime.archivedyet (wire field), so the read is defensive. On servers that do filter archived sessions fromGET /session, archived ids simply stay absent and behavior degrades gracefully to the pre-fix state.Observed behavior (live QA)
Driven on real opencode 1.18.15 in an isolated XDG sandbox (HOME + XDG_* redirected, sandbox DB seeded with one active + one archived session containing a unique needle; archived session deliberately given the newer
time_updatedto stress ordering):session_search({query: needle})[ses_qa_archived] [archived] ...; active hit listed before archived despite oldertime_updatedsession_list({include_archived: true})[archived], active firstsession_list({})Also verified against the server:
GET /sessionon 1.18.15 returns archived sessions withtime.archivedset, so the client-side partition works on the current release line. Full evidence (transcripts, isolation proof) in.omo/evidence/2026-08-22-session-search-archived/EVIDENCE.md.Verification
bun test packages/omo-opencode/src/tools/session-manager/— 74/74 pass (incl. new tests: search default-on, explicit opt-out, list default-off/opt-in, active-first append order, legacy sessions withouttime.archivedtreated as active, marker propagation, result-limit behavior)tsgo --noEmit -p packages/omo-opencode/tsconfig.json— cleantypecheck:packagescannot fully run in a fresh worktree (senpi/codex vendored artifacts are install-generated, not git-tracked); the failing tests there fail identically on cleandevin this environment and pass in a fully installed checkout. Not touched by this diff.Residual risk
MAX_SESSIONS_TO_SCANstill bounds the scan (by design, unchanged); archived sessions consume the remaining budget after actives./sessiondegrades to pre-fix (never worse).Summary by cubic
Restore archived session discoverability for agents. Previously,
session_searchsilently skipped archived sessions andsession_listcould not show them; now search includes archived by default (opt-out), and lists can include them with a flag, with clear [archived] markers.time.archived; archived IDs append after active IDs withinMAX_SESSIONS_TO_SCAN, so archived never displace active.session_search: new arginclude_archived(default true). Matches from archived sessions are marked [archived].session_list: default unchanged (archived hidden). New arginclude_archived: trueto include them; rows from archived sessions are marked [archived].getSdkAllSessions()returns{ active, archived };getAllSessions()returns{ ids, archivedIds }. Callers updated; file-backed fallback unchanged.GET /session, behavior degrades to pre-fix. Extensive tests cover defaults, opt-in/out, ordering, and marker propagation.Written for commit 3495e08. Summary will update on new commits.