Repository navigation
feat(session-control): session_history_list lists archived sessions a caller can revive - #16530
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check what an agent can do after [DESIGN-REVIEWED] 7baa709 Description read[DESCRIPTION-READ] 31c5510c587c34d0df71fa4f7b0aa70ecb9801e0823b4f50648899f5fa9ea6a8 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: let an agent find an archived session it may revive without guessing its key or title. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 7baa709 Description read[DESCRIPTION-READ] aa4d1c4149f2c7e564171c202720f535fa48f82b996b5a13f98fbabbeec4e48a That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
c64c438 to
eec542e
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
eec542e to
25c211f
Compare
|
Disposition for the First Principles CONCERNS on
Also on |
|
Self-review (crew-pr-reviewer, read-only): CHANGES NEEDED This adds a read-only |
|
Converted to draft by crew-pr-reviewer: the self-review above is CHANGES NEEDED. Mark ready again (gh pr ready 16530) once the points are addressed. |
|
Dispositions for d3f74d9 (advisory notes; no code change pushed for them). target=design: Checked in code. The refusals target=first-principles (item 7, |
d3f74d9 to
17e74be
Compare
|
Rebased onto main cf3c385 (the PR was DIRTY). New head 17e74be, still two commits, no logic change. Conflicts, resolved keeping both sides:
Local on this head: 17 scoped test files (1056 passed), the flake-pattern ratchet, black/isort/flake8 on changed files, and both docs lints. |
|
|
… caller can revive
…get predicate The walk ends at the first eligible row past the page, so no metadata read or session-store probe is spent beyond it; the reply says more and scan_truncated, with no row count. revive_session and the history scan both ask _archived_target_refusal, so a refusal added to revive hides that kind from the listing by the same edit. The scan asks it on metadata first and probes the store only for a row that passes. The listing tests read the catalog through newest_session_stems, a bounded stems-and-mtimes read, and backdate closed_at before any revive so a close and a resume never tie on a coarse clock.
17e74be to
7baa709
Compare
Replaces #15441 (by @Pearcekieser), rebased onto current
main. Fork PRs cannot consume/ai-reviewoverrides, so this is an in-repo replacement carrying @Pearcekieser's original commits unchanged in intent; only conflict resolution and main's moved code were adjusted (thekirocrew-dashboardtool count is now 36 because main added sibling tools, the tool is registered as aTool(...)row in main'sToolTablewith its handler as_run_session_history_list, the GET route is registered inserver_runtime/mcp_routes.py, and the session-control/feature-map/mcp docs were re-merged onto main's newer wording). Credit for the change is @Pearcekieser's.Problem / Motivation
Goal: an agent can list the archived sessions it is allowed to revive, so it can find the right
session_revivetarget without guessing a title.session_revive(#13110) needs a slot key, transcript name, or exact title, and nothing on thekirocrew-dashboardMCP server lists archived sessions.chat_folder_treeshows live sessions only. An agent asked to "reopen last week's investigation in folder X" cannot see what is there.list_sessions(mcp_tools/sessions.py) is the nearest existing listing, and it does not close the gap. It mixes live and archived sessions, has no folder filter, lists rows revive refuses (app-scoped, channel-linked, member DM threads, scheduled runs), and applies no ownership fence, so a fenced crew member or agent-created session sees titles of sessions it may not revive. This tool lists exactly the rowssession_revivewould accept for this caller.Why it matters
Three live tool descriptions (
chat_folder_move_session,chat_tag_assign,chat_session_pin) tell agents to bring an archived session back withsession_revivefirst. Without a listing, that advice only works when the agent already knows the key.Not a goal
search_chat_historydoes that).chat_folder_treeoutput.What changed (motivation → approach → change)
The listing is the finding half of a revive, so it applies revive's own rules and lists only rows revive would accept for this caller.
session_control.list_archived_sessionsruns revive's caller-side gate first (identity, live surface, ownership fence), then scans the history catalog newest first on a worker thread (_scan_revivable_history). It skips live slots, scheduled-run and member DM keys, non-persistent memory modes, app-scoped, channel-linked and mirrored sessions, and other workspaces. For a fenced caller it keeps only sessions whosecreated_byis the caller and whose crew-log lineage confirms it. When the lineage cannot answer, the rows are hidden andlineage_unknownis set. After the scan it re-checks the caller surface and drops rows that went live meanwhile.ConversationLog.newest_session_stems(max_entries)(history.py, backed byhistory_search.py) is a bounded catalog read: it stats transcripts and keeps only the newest N in a heap, reading no file content, so the scan's memory is capped by its own limit however large the archive is._fold_slot_key) so both paths fold keys the same way.GET /api/session-control/history(folder_id,limit) is added to the strict internal-secret route set inserver.py.session_history_list(folder?, limit?)(mcp_dashboard.py, schema invalidation.py): the folder is resolved read-only, and an unknown folder is refused rather than created or answered with an empty list.limitis 1 to 100, default 20, clamped by the backend too. The reply says when more rows exist.channel.py), tool title (data/mcp_tool_titles.json),docs/session-control.md(+ index count), the system spec, the MCP architecture doc and the feature map are updated. On rebase the count moved to 36 (21 session-control tools) and the feature-map/mcp rows were re-merged onto main's current text (keeping main'ssession_continue,session_generate_title,session_move_to_column,chat_folder_delete,chat_folder_file_selfandinclude_session_linkadditions).Backwards compatibility
Compatible: one read-only tool and one GET route are added. Revive behaves the same; only its fold helper moved.
Tests
test/test_session_control_history_list.py: ordering and live-slot skip, every listed row accepted byrevive_session, limit and clamp, folder filter and unknown folder, each revive refusal class hidden, fenced caller with confirmed, foreign and unreadable lineage, caller refused before history is read, a row revived mid-scan dropped, route forwarding, non-integer limit, strict route registration, and the MCP handler (rendering, read-only folder resolution, lineage note, missing strict key).test_mcp_dashboard_registration.py,test_mcp_dashboard_folders.py,test_session_control_doc.pyand the refusal-audit table intest_session_control.py; the MCP route-table and boot-trace pins intest_dashboard_server_composition_contract.pycount the new GET route. The MCP handler tests drive the tool throughTABLE.callwithInMemoryDashboardClient, as main's other session tools do.black --check,isortandflake8on the changed files,scripts/docs_lint.py --testandscripts/docs-lint.sh. CI runs the full suite andmypy.Manual verification
Backend-only, no UI change. The route and handler are exercised end to end through aiohttp in the tests above.
Related Issues
Fixes #15439
Pattern harvest
Rule candidate: when rebasing a fork PR that documents a count/list (tool counts, index rows), re-derive the count from the live source (
_tool_definitions()), not from the PR's frozen number — main may have added a sibling tool, so the correct post-rebase count is base+delta, not the PR's value.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Screenshots / video
Backend-only; no UI surface changes, so no screenshots apply.