Repository navigation
fix(session-control): authorize a created child on the store it is bound to - #11593
Conversation
…und to Read the caller's protected record under its canonical history key, so a member's authority does not depend on which of the three spellings of its own session key it supplied. Keep one delegation refusal, the memory_delegation_denied 403, with a fixed message. Fence the birth-time private pin to the store the delegation gate cleared. The pin derives its store from the selected agent's config entry, which is a different value, so the gate and the write could name different stores.
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the one inverted pin: the renamed test now asserts a global caller's child IS bound — the turn-path mechanism ( What this change shipsInventory (9 items) — 9 justifiedIntent: unwedge red
Counts run: [FIRST-PRINCIPLES-REVIEWED] 6eefcae |
GPT 5.6 Review — 🔴 changes requested (blocking)GPT 5.6 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/dashboard/session_control.py:1425 -- target store is treated as authorization Adjudication (Opus 4.8) — is blocking on each finding proportionate?I've traced the full chain. Let me confirm my understanding of the key conditions. The finding F1 concerns the recently-added
The conditions (a global caller invoking create_session; naming a private V2 member) are ordinary, not extreme or mutually contradicting. I cannot construct a rarity argument that a human would accept the residual cross-member private-memory exposure. The harm term is unbounded (privacy/governance ceiling bypass). FLAG's evidence bar is not met → UPHOLD-FENCED. Harm rung: UNBOUNDED — private-memory ceiling bypass, global caller drives/reads another member's V2 store. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Inverting the "global caller cannot grant private authority" pin ratifies that agent selection alone binds an unfenced caller's child onto a member's private store. WatchThe renamed test now asserts [DESIGN-REVIEWED] 6eefcae |
Opus 4.8 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: |
|
Answering the Design Review CONCERNS on the merits, including the third The citation it asks for exists. #11018's own PR body states the decision in The same source also independently supports this PR's group B fix: "Creation The third resolution, stated so it is on record rather than skipped. Refuse a
On the escalation itself. The mechanism is real and predates this PR: The residual concern -- that an unbound session steered by untrusted external Nothing here relaxes an assertion to match current behaviour: five of the six |
|
/ai-review override gpt 6eefcae: Already-compromised test fails. The surface sits behind _require_internal (X-Internal-Secret) and every untrusted private V2 caller gets member_scope_denied 403; the only caller that reaches this path is the owner / Global-V1 caller (spec session-control.md:200-214), who already holds authority over every member and store. Binding its child to the selected member own store (which slot.memory_store already names) grants the owner nothing it cannot already do; the spec (255-268) documents this deliberately and rejects the unbound-child alternative because the turn path then raises memory_unavailable. |
|
AI-review override not recorded: keep the reason to 500 characters or fewer. |
|
/ai-review override gpt 6eefcae: Already-compromised: the surface sits behind _require_internal (X-Internal-Secret); every untrusted private V2 caller gets member_scope_denied 403, so the only caller reaching it is the owner/Global-V1 caller (spec 200-214) who already holds authority over every member and store. Binding its child to the selected member own store (which slot.memory_store already names) grants nothing new. Spec 255-268 documents this deliberately; the unbound alternative breaks turns. |
Human judgment recorded@chenmingwei23 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
|
Human judgment recorded, but the following reviewer lane(s) could not be re-run automatically: GPT 5.6. Re-run the lane's latest workflow run for |
…und to (kirodotdev#11593) Read the caller's protected record under its canonical history key, so a member's authority does not depend on which of the three spellings of its own session key it supplied. Keep one delegation refusal, the memory_delegation_denied 403, with a fixed message. Fence the birth-time private pin to the store the delegation gate cleared. The pin derives its store from the selected agent's config entry, which is a different value, so the gate and the write could name different stores. Co-authored-by: Raymond Chen <chenmingwei23@users.noreply.github.com>
Problem / Motivation
mainis red at tip onBackend Tests, and because CI evaluatesrefs/pull/<n>/merge, every open PR inherits the failure on its own board.Run
35254907186, head0640c1e0d,event=push,branch=main:failure=5,skipped=6,success=29. Failed jobsBackend Tests (Windows) (5),(Windows) (7),(3.12, 5),(3.12, 6),Coverage Gate. Six tests, in twogroups:
test/test_member_session_control.pytest/test_session_control.pyWhy it matters
Nothing else can go green until this does. Every open PR shows four backend
shard reds plus a
Coverage Gatecascade (backend-test=failure -- failing closed) and aPR Readinesscascade that its own diff did not cause, soauthors either chase a red they cannot fix or fold a session-control change
into an unrelated PR.
Underneath the red, two of the failures are a real weakening of the private
memory boundary, and one of the passing tests was pinning it open.
What changed (motivation -> approach -> change)
Where it came from
#11438's own CI was fully green: 72SUCCESS, 11SKIPPED, zero failures athead
af6ad53b5b. Its base wasb6ec82e02a, andgit merge-base --is-ancestor 164d30d944 b6ec82e02aanswers no: that base doesnot contain
164d30d944,fix: preserve member identity through dispatch and continuation (#11018).maingained 27 commits including#11018between thatbase and the merge.
#11018and#11438solve the same problem independently.#11018's commitmessage states it directly: "Publish protected choices before birth", "Private
callers create workers only in their own store." The collision exists only on
main, which is why neither PR's own CI could see it.Which reading I took
Reading (b), the production change weakened a boundary, for five of the six
tests. Reading (a) for exactly one, argued below. Neither group's assertions
were relaxed to match what the code returns.
Group B: a second delegation gate, weaker on four axes
create_sessionnow had tworequire_memory_delegationcall sites. The one#11438added runs first and shadows#11018's. It differs on four points, eachin the losing direction:
It is evadable by re-spelling. It passes
caller_session_key-- whatever thecaller called itself -- where the existing gate passes
caller_memory_identity[0],the canonical history key.
read_private_session_storerecognises only thecanonical form. The failure pattern proves it: of the six
test_private_creator_cannot_change_memoryparams only the twocanonicalonesfail, while
[writer-slot],[writer-stem],[public-worker-slot]and[public-worker-stem]pass, because under those spellings the new gate does notrecognise the caller as private at all and the request falls through to the
older gate. An authorization input the caller chooses the spelling of is a
bypass, not a lenient read.
It downgrades the refusal.
agent_store_mismatchis a 400;memory_delegation_deniedis a 403. The store is a legal name and the request iswell formed -- the answer is "you may not delegate there", so a validation code
misinforms the caller and reads as a client bug in the audit trail.
It leaks the record's path.
SessionControlError(str(exc), ...) from exccarries the text of a function that reads binding FILES.
test_create_refuses_unreadable_delegation_identityasserts"/private/identity/path" not in str(exc.value); the existing site uses a fixedmessage and
from Nonefor exactly that reason.It omits
OSError.except (UnknownMemoryStore, ValueError)lets theunreadable-file case escape
create_sessionas an unhandled 500 -- the[OSError]failure. The existing site catches
(OSError, ValueError).The fix: the early block stops re-implementing the refusal. It reads only the
caller's own protected record, which is the one thing it actually needs
(
caller_private_store, the input to the child-binding decision further down),under the canonical key, and maps a failure to the same 403 with the same fixed
message. The delegation refusal itself belongs to the one gate that already made
it correctly.
Group A, first test: the gate authorizes one store, the write names another
test_a_v1_child_writes_no_private_bindingis reading (b), and the mechanism isnot in
#11438at all._persist_birthcalls_pin_private_agent_assignment,which derives the store to pin from the SELECTED AGENT's config entry, while the
delegation gate above checked
bindings.memory_store_name. Those are differentvalues. A local probe caught the divergence directly: a child with
slot.memory_store == 'default'was written a binding namingmember-radar, fromchat_persistence.py:880, for a caller with no private record at all.The fix passes the authorized store down and pins nothing when the two disagree,
so the act matches the check. The owner's own agent picks pass no authorized
store, because there the pick IS the authority.
Group A, second test: reading (a), and why
test_global_caller_cannot_grant_a_child_private_authorityassertschild.memory_store == "member-radar"on one line and no private binding on thenext.
chat_runner._bind_private_slot_memoryraisesUnknownMemoryStore->memory_unavailableon exactly that pair, atchat_runner.py:8518: a slot whosemetadata names a V2 store and whose binding is absent can never take a turn.
The test pins the defect
#11018fixed, so satisfying it would restore it.It is renamed to
test_global_caller_binds_a_child_only_to_the_member_it_selectedand now pins the invariant that matters: the child is bound to the store the
delegation gate authorized -- the selected member's own -- and to nothing else, and
the caller's own protected record stays unbound, so the caller gains nothing.
The escalation the old name was reaching for, a child on a store the gate did not
authorize, is
test_a_v1_child_writes_no_private_binding, which is unchanged andnow passes.
Where the older contract was decided, and the alternative weighed
#11018's own PR body states the decision this PR keeps, in one clause: "Private
callers create only same-store workers; Global callers retain member
assignment." The same paragraph names the capability that refusing would remove
-- owners reopening member conversations and seeing delegated workers -- and its
design table's Delegation row states the mechanism: "publish selection and pin
assignment before birth metadata".
That source independently backs the group B fix too: "Creation checks the
canonical caller key before allocation." The gate #11438 added keyed on the raw
caller-supplied spelling instead, which is exactly why only the
[*-canonical]params fail.
A third resolution exists and is not taken here: refuse a global caller's
member-agent selection outright, rather than binding the child or minting a dead
one. It removes a shipped capability, so it is a product-shape change needing an
RFC already on main, and it would widen a main-red fix while four PRs inherit that
red. Raised as its own issue (#11613) so it survives this PR either way. This PR
narrows the path instead: the birth pin is fenced to the store the gate authorized,
so a child can no longer land on a store the gate never saw.
Also updated
Three tests from
#11438expectedagent_store_mismatchfrom the delegationpath. They now expect
memory_delegation_deniedandstatus == 403, and two ofthem additionally assert the refusal does not echo the guard's own text. That is
the older contract winning on its merits, not a relaxation: it is stronger on
status, on message hygiene, and on the exception set it catches.
docs/system-specs/modules/session-control.mdmoves with the code. It had stated"An unbound/global caller keeps ordinary creation behavior, with no private
binding even when the chosen agent names a V2 store", which is the assertion the
turn path reads as
memory_unavailable.Tests
The six failing tests pass unchanged except for the one rename, which is argued
above.
Added, both of which fail without a specific part of this change:
test_the_child_binding_ignores_how_the_caller_spelled_itself[canonical|slot|stem]pins that the pre-birth binding happens for every spelling of the caller's own
session key, observed at the moment the birth pin runs. Under the raw-spelling
read,
[slot]and[stem]fail and[canonical]passes -- the bug's exactshape.
test_a_corrupt_caller_record_refuses_without_naming_itpins the early block'sown refusal:
memory_delegation_denied, 403, and the record's path absent fromboth
exc.value.messageandstr(exc.value).Manual verification
Reproduced first, on a worktree off
origin/mainatc5842a635cwithKIROCREW_HOMEpointed at a scratch directory: the two group A tests fail inisolation (so not shard pollution), and group B fails 4 of 8 params.
Mutation matrix over the change, run out-of-tree: 7 mutants, 0 holes, with the
clean tree green (46 passed) both before and after the run, and every anchor
counted before use so an unmatched anchor is a hard failure rather than a skipped
check.
[slot],[stem]agent_store_mismatchtest_a_v1_child_writes_no_private_bindingtest_a_v1_child_writes_no_private_bindingOSError..._unreadable_delegation_identity[OSError]agent_store_mismatchAdjacent sweep, all green: 684 passed across
test_member_session_control.py,test_session_control.py,test_session_control_member_gate.py,test_member_memory_api.py,test_member_memory_runtime.py,test_member_memory_ownership.py,test_cron_session_control.py,test_chat_agent_selection.py.Gates run before committing, each as its own invocation:
scripts/check_black_formatting.py,black --target-version py310 --check,isort --check-only,scripts/check_comment_history.pywithCOMMENT_HISTORY_BASE_REF=origin/main,scripts/check_brand_name.py,scripts/check_subprocess_encoding.py. All exit 0.Related Issues
Fixes #11585
Pattern harvest
Rule candidate: semgrep
Pattern: a private-memory authorization read keyed on a caller-supplied session
key instead of the canonical history key --
read_private_session_storeorrequire_memory_delegationreceiving a raw*_session_keyparameter where acanonical identity is in scope.
The class generalizes twice over. The first shape is one decision made at two
sites: a second gate added for a question an existing gate already answers will
drift, and the weaker of the two wins because it runs first. A review-prompt line
covers it -- when a change adds a guard, name the existing guard for the same
decision and reuse its refusal rather than minting a second code. The second
shape is a gate that validates one value and an act that uses another; here the
gate read
bindings.memory_store_nameand the write derived its own store fromthe agent config.
Checklist