Repository navigation
feat(mcp): session_set_note leaves a note in a session you created - #31405
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the tool reuses the Notes
[DESIGN-REVIEWED] f8b8ede Description read[DESCRIPTION-READ] 3b0009af05ec33c0b74fb850287efdb259c5d4a941c1e096eebcf9f0c28b1e29 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 blocks. The new tool reuses the What this change shipsInventory (10 items) — 9 justifiedIntent: A conductor can leave a note that a worker session it created reads on its next turn, without starting a turn there. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] f8b8ede Description read[DESCRIPTION-READ] 70982c551c5ece9a2355ce43482f2ee7c7dac7f9f115814ff01c2480562cbe10 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: |
a61537d to
1c9c2a9
Compare
1c9c2a9 to
12331e7
Compare
12331e7 to
6855c93
Compare
6855c93 to
23d2cff
Compare
|
self-added: yes
[operator: bolichen97] AI-assisted, posted on behalf of bolichen97 |
1ad7d90 to
4c9a2de
Compare
|
Rebased: main moved in docs/feature-map/README.md, test/test_dashboard_server_composition_contract_reach.py and src/kiro_crew/dashboard/chat_turn/turn_context.py, which conflicted with this branch (6f786d9 -> b358303); CI re-running on 4c9a2de. Both sides are kept: the session-control feature-map row has main's text plus set-note, the MCP route-table pin counts main's routes plus set-note, and a background-context frame both neutralizes look-alike frame lines in its content (#33416) and ends at this PR's tagged end marker; the frame tests that matched the untagged marker or verbatim forged lines match the tagged marker and the neutralized text, and the strip tests still pin the raw-text case. AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
4c9a2de to
795f7e6
Compare
|
Rebased: main moved in test/test_dashboard_server_composition_contract_reach.py, which conflicted with this branch (b358303 -> 0c52318); CI re-running on 795f7e6. The MCP route-table pin counts main's routes plus set-note. The same head carries the fixes for the GPT restart/cancel finding and the First Principles end-marker tag finding; each has its own disposition below. AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
Rebased: main moved in test/test_dashboard_server_composition_contract_reach.py, which conflicted with this branch, and in test/test_dashboard_server_composition_contract.py, whose red lazy-import pin main fixed in #34010 (0c52318 -> fd5d9ef); CI re-running on 2d3d8fc. The MCP route-table pin counts main's routes plus set-note. The same head removes the replay exclusion and the keep-until-read chain the First Principles review blocked on, so a written note is transcript history as the frozen Not-a-goal states, and the late containment drop of a waiting note's context half stays; each span has its own disposition below. AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
self-added: yes
AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
|
Re-sync budget reset This PR is inside its 48-hour watch window. Main has moved into its files again since 2d3d8fc was pushed: docs/feature-map/README.md and docs/system-specs/modules/session-control.md now conflict with it, so it needs one more re-sync before CI can run. AI-assisted, posted on behalf of bolichen97 [operator: bolichen97] |
Adds a kirocrew-dashboard tool so a conductor can leave a note in a
worker session it created without starting a turn there: a note line
in the transcript, labelled session_set_note, which the worker's next
turn reads once as background context.
The new strict-internal route POST /api/session-control/set-note
gates with authorize_created_target, the gate session_set_color now
shares (authorize_target, then the creator fence for every caller),
and writes through write_slot_note, the body of
POST /api/chat/slots/{slot}/note, so the limits, redaction, hold
during a running turn and reply are that route's.
The note's context half carries the containment the gate admitted.
Before the drain it is dropped when the target now holds a constraint
authorize_target refuses, such as a channel mirror gained meanwhile,
as a queued session_send message is; its transcript line stays. A
half held across a restart keeps only its admitted workspace.
Closes #15424
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/session-control.md and test/test_dashboard_server_composition_contract_reach.py, which conflicted with this branch (fd5d9ef -> dcd4830); CI re-running on f8b8ede. The code is the same as 2d3d8fc. The two doc rows keep main's text and add the set-note entries. The MCP route-table pin goes from main's 348 rows to 349, which is main's table plus the one set-note route. [operator: bolichen97] |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 15% chance that this change introduces a defect, above the 12% limit for approving on its own. I'd approve this one; nothing in it blocks. What I checked:
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
buluoray
left a comment
There was a problem hiding this comment.
Approve on f8b8ede. session_set_note lets a conductor leave a next-turn note in a session it created. It is gated like session_set_color, reuses the /note write path, drops the note's context half when the target gains a mirror or moves workspace, and the MCP tool is stateless. No defect found. Decisive lines: src/kiro_crew/dashboard/session_control_parts/session_titles.py:323 (authorize_created_target: authorize_target, then the creator fence), src/kiro_crew/dashboard/handlers/session_control.py:859 (strict-internal set-note route, mirror re-check after the gate, write_slot_note with no await between), src/kiro_crew/dashboard/chat_turn/turn_context.py:814 (drop_session_notes_out_of_reach), src/kiro_crew/dashboard/chat_turn/prompt_assembly.py:810 (wired before the only drain), src/kiro_crew/mcp_tools/table.py:255 (strict key resolved per call)
Problem / Motivation
Goal: A conductor can leave a note in a worker session it created, which the worker's next turn reads, without starting a turn there.
A conductor that opens workers with
session_createcan send them a whole turn withsession_send, but it cannot drop a short note that a worker reads later without waking it. The note route crons and apps already use,POST /api/chat/slots/{slot}/note, is out of reach of thekirocrew-dashboardMCP server, and it has no caller-ownership fence for agent callers.session_set_color(#15428) shipped the other half of this issue.Why it matters
A conductor that learns something a busy worker needs ("the base moved", "PR 12 merged") must either interrupt the worker with a turn or leave it working on a stale picture. A note lands now and is read at the worker's next turn, the way a cron's note already is, and the person sees it in the worker's transcript.
Not a goal
/noteroute's behaviour for apps and crons.session_sendmessage.What changed (motivation → approach → change)
A conductor can leave a note in a worker session it created: the worker reads it once at its next turn, and no turn starts there, so a busy worker learns what changed without being interrupted. The note takes the
/noteroute's own code, behind the gatesession_set_coloruses.session_set_note(target, note)Toolrow in the session-control family, strict identity, callingPOST /api/session-control/set-noteauthorize_created_targetrunsauthorize_target(the caller itself is refused), then the creator fence for every caller;session_set_colornow uses the same gate.write_slot_notethen writes the note with nothing suspending in betweenwrite_slot_note/noteroute after its own checks (deliver_note, its audit row and its reply), moved into a function the route calls, withdeliver_notetaking the admission for the context half, so both routes share the transcript line, the next-turn context half, the hold while a turn runs, the limits, redaction and reply. A note is labelledsession_set_noteon both halves, so the person sees who wrote itadmission, a key onlywrite_slot_notesets). Before the drain,drop_session_notes_out_of_reachcompares it with the worker's containment now and drops the half when a constraintauthorize_targetrefuses newly holds (a mirror or link gained, a workspace move), as the queue drain drops a waitingsession_sendmessage. A mirror seen when that admission is read refuses the note, as the gate does. A half the turn keeps (and has not expired) is recorded as that turn's audience admission, so a channel linked before the reply withholds the reply. A half held across a restart keeps itsadmissionkey with only the admitted workspace (slot_buffers._sanitize_restored_context), so the drain still judges it. Anote_containment_dropSEL row records each drop/noteline: it stays when the half is dropped, history replay carries it, and its hold retires with its committed rowThe issue asks for the note to take the
/noteroute's own code path, so that route's handler is split where its own checks end and the new route joins it there after its gate. The two concerns the earlier attempt in #15428 raised are answered by structure, not by matching text: a note's look-alike frame lines are neutralized by the drain, as every producer's are, so a note cannot close its own frame; a waiting note's context half is never read by a turn whose audience or workspace changed from the one it was admitted for, and a reply that used it is not published to an audience it was not admitted for. The tool is blocked for channel agents and withheld from unattended conductor grants, assession_set_coloris.Where it lives: the tool row in
mcp_dashboard_session_tools.pyand its body inmcp_dashboard_session_runs.py(bound bymcp_dashboard.py); the schema invalidation_parts/messaging_session_schemas.py, registered invalidation_parts/server_registries.pyandvalidation.py; the title indata/mcp_tool_titles.json; the gate insession_control_parts/session_titles.py, exported bydashboard/session_control.py; the route inhandlers/session_control.py,server_runtime/mcp_routes.pyanddashboard/server_internal_paths.py; the shared note body inchat_api/slot_note.py, exported bydashboard/chat_handlers.py; the late drop inchat_turn/turn_context.py, called fromchat_turn/prompt_assembly.py; the restored admission inslot_buffers.py; the channel block inchannel.pyand the withheld-grant note inagent_parts/spec_grants.py; the reference indocs/session-control.mdanddocs/index.md, the spec row indocs/system-specs/modules/session-control.md, the tool list indocs/architecture/mcp.mdand the row indocs/feature-map/README.md.Backwards compatibility
Compatible: one new tool and one new route; no other route, argument or reply changes. The
/noteroute's code moved into a function it calls, and its tests pass unchanged, so its behaviour for apps and crons is the same, a note under thesession_set_notelabel included. The background-context frame every producer gets is unchanged frommain.Removes nothing: no route, key, field or capability is taken away.
Tests
test/test_session_control_note.py: a note reaches a created session as a transcript line plus asession_set_notecontext entry, with no turn started; the person's own tab (not_creator), the caller itself (self_target) and a channel-linked session (linked_session_target) are refused with nothing written; an empty note is refused before the gate; a running target holds the note; the route is strict-internal and loads a lazily restored target off the loop before its gate; a note quoting an end marker drains as one plain, neutralized frame; a note still waiting when the session gains a mirror, or moves to another workspace, is not read while its transcript line stays; a mirrored session drops the context half while history replay carries the row; a note held across a restart is read, and is still dropped after a workspace move, when the session is now mirrored even if the saved line was edited to claim the mirror was admitted, and when the saved admission lost its workspace; an app's/noteunder thesession_set_notelabel is accepted and read as plain context; a note the turn read withholds the reply from a channel linked afterwards, and an expired note withholds nothing; a mirror linked between the gate and the admission read refuses the note (mirrored_target) with nothing written; the tool sends the verified key and reports the immediate, held, context-skipped and refused outcomes.test/test_session_control_member_gate.py:set-noteis one of the routes that must forward the carried member verdict.MarkdownRenderer, whosewebsite/src/test/MarkdownRenderer.sanitize.test.tsxpins that scripts, event handlers andjavascript:links are stripped. This PR changes no frontend file.write_slot_note.test/test_session_control_note.pypassed 20 repeated runs at-n0, 10 runs at-n 4 --dist loadgroup --max-worker-restart=2besidetest/test_session_control_color.pyandtest/test_gateway_appkit_endpoints_note.py, and a shuffled order (seed 41405).Manual verification
N/A: the route runs through its real handler against a real
DashboardState, the drain throughchat_runner.drain_pending_context, the restart through the hold's ownserialize_deferred_notesandsanitize_restored_deferred_notes, the replay throughbuild_session_replay, and the tool through the realTABLE.callframe.Screenshots / video
N/A: no frontend file changes. The note line renders through the existing note bubble an app or cron note uses.
Related Issues
Closes #15424
Sibling sweep
N/A: a feature, not a defect fix.
Pattern harvest
Not generalizable: a new tool, not a fixed defect.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.