Repository navigation
fix(dashboard): keep a recent-restored relay chat read-only - #18088
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the RFC's tracking row for #10826 ( [DESIGN-REVIEWED] 1865602 Description read[DESCRIPTION-READ] 517a546566e8365894a520c0843dba520d03986b14078c560d0ab8484f2090e9 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (3 items) — 3 justifiedIntent: when a user reopens an old relay chat from the recent-sessions list, it should stay a read-only archive and not quietly turn into a local chat that runs on this machine. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 1865602 Description read[DESCRIPTION-READ] bdd99504e84c22dfe6002340a49ca420b552d2a25251b1879d023c289108415c That sha256 names the PR description this verdict read. Recompute it with |
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: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
…ions restore brings it back
4a36cc4 to
1865602
Compare
|
Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE This fixes #10826 at the root: the metadata field table listed only RESTORE for the executor, instance_id and remote_slot rows, so the recent-sessions restore (RECENT) never ran _read_executor and an old relay chat came back as a runnable local chat that then lost its marker on the next save. Adding RECENT to those three rows makes both startup restores go through the same fail-closed reader. RESUME stays local on purpose, and the PR leaves it alone. I read the full diff and _read_executor, and grepped every consumer of executor == "remote" / is_relay_archive (chat_runner, chat_handlers, session_control, openai_compat, chat_folders). They all treat the restored slot exactly as they already do after RESTORE, so I found no new side effect. The new test drives codec.apply through RECENT, checks the 409 relay_archive_read_only refusal and checks that the encode writes the binding back. The description shows it red on main, and the pinned asymmetry table was updated with it. Both Design and First Principles lanes PASS on the current head 1865602, checks are green, the base is main and there is no open change request. — crew-pr-reviewer |
buluoray
left a comment
There was a problem hiding this comment.
Approve at 1865602a49144aacf3ec51320df8e269b715e1eb.
A relay chat brought back from the recent-sessions list now restores as the same read-only archive as an open-tab restore, instead of coming back local and running the other machine's conversation here.
Verified at head:
src/kiro_crew/dashboard/slot_persistence/metadata_codec.py:688: theexecutorfield now applies toRECENTas well asRESTORE, written whole or not at all via_if_bound.metadata_codec.py:1066_read_executor: aremotemarker is kept even when the target fields are incomplete, so a half binding fails closed (the incomplete-binding guards refuse the send) rather than resurrecting a local session.metadata_codec.py:1572andsrc/kiro_crew/dashboard/relay_archive.py:29: the archive marker survives the next save.- Ordinary and local recent sessions stay writable and never get an
executorfield.
Fail-closed: the only new behaviour on a bad record is refusing to run locally. Upgrade impact / audience fit: affects relay archives only; ordinary recent sessions restore exactly as before.
Mutation: removing RECENT from the executor row reddens 4 tests. test_slot_metadata_codec.py + test_relay_archive.py + test_session_restore.py: 121 passed.
Non-blocking follow-up: docs/request-for-change/rfc-remote-crew-sidebar.md:71 still lists "Executor lost on restore" as a current defect (_apply_recent_session never restores executor ... "The next send runs locally"). This PR closes it, so please mark that row resolved.
CI: 85 success, 13 skipped, 0 failing. Not run: full suite, Windows/macOS.
Problem / Motivation
Goal: An old relay chat brought back by the recent-sessions restore stays a read-only archive, the same as when the open-tab restore brings it back.
A chat that a peer crew once ran through the retired turn relay carries
executor="remote"on its metadata line. After #17642 and #17662 such a chat is a read-only archive: every run path answers409 relay_archive_read_only. But the recent-sessions restore (_apply_recent_session, theRECENTpurpose) never read the marker. So the chat came back as a plain local chat. Its next send ran the crew's turn on this machine, and the next full save wrote the line without the marker, so the chat lost its archive status for good.Why it matters
A user who reopens an old crew chat from the recent list can send into it and get a local agent replying to a conversation another machine owned. The
relay_archive_read_onlyguard exists to stop exactly that, and the open-tab restore already honours it.Not a goal
RESUMEpurpose (History resume and transfer import). It deliberately brings the session back local, as itswhytext says.What changed (motivation → approach → change)
Symptom: a recent-restored relay chat runs locally and loses its marker. Cause: in the metadata field table, the
executor,instance_idandremote_slotrows listed onlyRESTOREas a purpose, so_read_executornever ran forRECENT. Change: addRECENTto those three rows inslot_persistence/metadata_codec.py, and rewrite theexecutorrow'swhytext, which named this gap. Both startup restores now keep the marker, sois_relay_archivesees it and every run path refuses with the existing 409.Backwards compatibility
Compatible: a line without
executor="remote"reads exactly as before; only old relay chats change, from runnable-local to the read-only archive they already are on the open-tab restore.Removes nothing: the change makes one more purpose read three existing fields; no key, route or record is dropped.
Tests
test/test_slot_metadata_codec.py::test_a_recent_restored_relay_chat_stays_a_read_only_archive: a relay line read throughRECENTkeepsexecutor/instance_id/remote_slot,relay_archive_refusalanswers 409relay_archive_read_only, and the next encode writes the binding back. Red on main (('local', '', '') == ('remote', 'inst-1', 'rs-1')), green with the fix.test_the_table_declares_every_asymmetry_the_readers_had: the pinned purposes for the three rows now read["recent", "restore"].test_session_restore.py,test_relay_archive.py,test_chat_slot_create_remote_retired.py,test_chat_persistence_composition_contract.py,test_dashboard_contract_pins.py,test_crew_main_contract.py,test_resume_publishes_hydrated_slot.py,test_local_turn_restart_marker.py,test_flake_pattern_ratchet.py.Manual verification
N/A — unit coverage sufficient: the change is a field-table purpose set, and the test drives the same
codec.applythe recent restore calls.Related Issues
Closes #10826
Part of #6180
Pattern harvest
Not generalizable: the field table already pins every purpose asymmetry in
test_the_table_declares_every_asymmetry_the_readers_had; this row was a declared asymmetry that #17662 made wrong, not an undeclared one.Checklist