Repository navigation
fix(session-control): keep the delegation refusal a 403 and stop it leaking the binding path - #11603
iamwhatever wants to merge 1 commit into
Conversation
…eaking the binding path The member-dispatch delegation guard added in #11438 sits on the common create_session path, so it shadowed the established refusal for every caller: an authorization refusal downgraded from 403 memory_delegation_denied to 400 agent_store_mismatch, the raw exception text (the private binding path) reached the caller, and OSError was not caught at all, escaping as an unhandled 500 instead of refusing.
|
Intent: Unbreak |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Owning spec still says the corrupt/unreadable binding maps to Watch
The test rewrite is justified, not a trigger: the 403 pin in [DESIGN-REVIEWED] e053f72 |
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: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify What this change shipsInventory (5 items) — 5 justifiedIntent: restore the memory-delegation refusal to the 403
Pin-rewrite evidence checked: the opposing, older pin ( [FIRST-PRINCIPLES-REVIEWED] e053f72 |
|
Closing as superseded by #11593. Both PRs rewrite the same
Verified locally on #11593's head: Nothing here is lost; if any wording from this PR's comments is worth keeping, fold it into #11593. |
|
Superseded by #11593, which landed the same fix and went further. #11593 keeps one delegation refusal — the 403 Verified on Closing unmerged — nothing here to salvage. Thanks @chenmingwei23. |
Problem / Motivation
mainis red. Four tests intest/test_session_control.pyfail on every PR, because a guard added on the shared session-creation path took over a refusal that already had an owner.Refusing to let one member's work be launched into another member's private memory is the check involved. It answered the wrong way in three separate ways at once.
Why it matters
Every open PR inherits these four failures, so nobody can tell their own red from this one. That is how the second half of the same breakage went unnoticed for hours:
main's own post-merge runs are allcancelled, so nothing was watching.The three wrong answers are not cosmetic. One of them puts a private filesystem path into a message that goes back to the caller. One of them turns "I could not check" into an unhandled crash instead of a refusal — the single outcome a permission check must never produce.
What changed (motivation → approach → change)
The refusal goes back to being a 403 that says nothing about the host.
400 agent_store_mismatch403 memory_delegation_denied400, message = the private path403, fixed message, no pathOSError→ 500403, fixed messageThe guard lives in
src/kiro_crew/dashboard/session_control.pyand reads the caller's own binding off disk, so it can fail three ways, and the three mean different things. It was catching them as one and answeringstr(exc), which is how the path escaped.OSErrorwas not in the catch at all, so an unreadable file crashed the request instead of refusing it.Now the real refusal keeps its own authored sentence, which is safe to show and says what the caller can do about it. The two "cannot verify" cases share one fixed sentence that names nothing on disk. Both are 403, because the request is well formed and the caller simply may not do this — the older test file has said so all along.
Ordering is load-bearing and the code says so: the refusal type subclasses the broad one, so its arm has to come first or every refusal collapses into the generic message.
Three assertions in
test/test_member_session_control.pyasked for the old400. They were the newer of two contradicting descriptions of the same behaviour, and this PR resolves the contradiction toward the authorization reading.flowchart TB subgraph BEFORE["Before"] direction TB B1["guard cannot answer"] --> B2["one catch, str(exc)"] B2 --> B3["400 + private path"] B1 --> B4["OSError uncaught"] B4 --> B5["500 crash"] end subgraph AFTER["After"] direction TB A1["guard cannot answer"] --> A2["refusal vs cannot-verify"] A2 --> A3["403, path never shown"] end class B3,B5 removed class A3 added class B1,B2,B4,A1,A2 ctx classDef added fill:#DCFCE7,stroke:#16A34A classDef changed fill:#FEF3C7,stroke:#D97706 classDef removed fill:#FEE2E2,stroke:#DC2626,stroke-dasharray: 4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7 linkStyle 2 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 4 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 6 stroke:#16A34A,stroke-width:2px🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
A caller now learns it was refused, and learns nothing about the machine.
Tests
The four already-failing tests in
test/test_session_control.pypass without being touched — they are the regression test, and they were written before the defect. Intest/test_member_session_control.pythe three contradicting assertions now expect the 403, and the corrupt-binding one additionally asserts the private path is absent from the message, which nothing pinned before.Manual verification
N/A — unit coverage sufficient. Each of the three inputs is driven directly, one by the real guard end to end and two by raising the exact exception the guard raises.
Known incomplete
maincarries a second, separate defect from the same commit, which this PR deliberately does not touch:_pin_private_agent_assignmentbinds a new session to a private store without checking that the creator had authority to confer it, re-granting what the authority check increate_sessionwithheld. It failstest_global_caller_cannot_grant_a_child_private_authorityandtest_a_v1_child_writes_no_private_binding, both onmainbefore this PR. That is a change to who holds private-memory authority and belongs in its own reviewed change, so those two stay red here.Related Issues
no linked issue: found while driving an unrelated PR whose CI inherited these failures.
Pattern harvest
Rule candidate: review-prompt
Pattern: a new guard placed on a shared path silently takes over an existing refusal, changing that refusal's status code, message and error class for every pre-existing caller.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)