Repository navigation
refactor(dashboard): route the last two slot 404s through slot_not_found - #21711
Conversation
The fork handler's unknown-slot branch and the skill gate's app refusal still built the slot_not_found 404 by hand. Both now call slot_ownership.slot_not_found(), so every dashboard branch that answers this 404 reads one definition. prompts_caller_gates drops its private _CODE_SLOT_NOT_FOUND spelling, which nothing else read. Both branches return the same status, body and content type. A source scan now fails on any dashboard module that hand-builds this 404.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the [DESIGN-REVIEWED] abdc857 Description read[DESCRIPTION-READ] 6a401f0253b28eba927ecede720cd55a41cad45944ee46e1ca54a621bea8ae00 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 One thing to check: What this change shipsInventory (5 items) — 5 justifiedIntent: Make every dashboard branch that answers the uniform no-such-slot 404 read one definition, without changing what clients receive. This is a FIX (a refactor removing two duplicate copies).
[FIRST-PRINCIPLES-REVIEWED] abdc857 Description read[DESCRIPTION-READ] 5d19f4f0186404509ba0da6d9446d1ff573646d4efc6b54b2bd3e64156cb08ef 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: |
|
[operator: bolichen97] Punchline answered: rebutted (in scope as written).
|
|
[operator: bolichen97] Punchline answered: rebutted (in scope as written).
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the two remaining hand-built slot 404s now return the shared slot_not_found() response, with a source scan test that keeps new copies out.
Problem / Motivation
Goal: Make the last two dashboard branches that hand-build the uniform
slot_not_found404 callslot_ownership.slot_not_found(), with no change in what the client receives, so every branch that answers it reads one definition.#21555 and #21670 routed the other copies. Two are left: the fork handler's unknown-slot branch in
chat_fork.py, and_deny_foreign_app_skill_slotinhandlers/prompts_caller_gates.py, which spells the code through a private_CODE_SLOT_NOT_FOUND.Why it matters
Nothing is broken today.
slot_not_found()is the one 404 an app gets for a slot it may not act on or that does not exist. A hand-built copy keeps answering the old body if the helper ever changes. The skill gate's refusal must stay indistinguishable from "no such slot", so it should build that 404 from the same function the other isolation refusals use.Not a goal
"slot not found"inhandlers/redaction.py): routing it would change the response.slot_not_found(), any refusal decision or audit row, or what any branch returns.What changed (motivation → approach → change)
Both remaining copies now call the helper, so no dashboard module builds this 404 by hand.
chat_fork.pyslot_not_found(); name added to its existingslot_ownershipimporthandlers/prompts_caller_gates.pyslot_not_found(); private_CODE_SLOT_NOT_FOUNDdeletedhandlers/prompts.pyTYPE_CHECKINGlist drops the deleted constant and namesslot_not_found, which its facade now serves from that ownerNo import adds boot work:
slot_ownershipis already loaded at module level throughchat_threadsand thechat_handlersfacade.test_chat_fork_error_codes.py's per-file count drops from 27 to 26: the unknown-slot 404 is now counted inslot_ownership.Merge cost: #15957 and #17165 each add an import line right above
chat_fork.py'sslot_ownershipimport, so whichever lands second takes a one-line rebase (keep both imports).Backwards compatibility
Compatible: both branches return the same status, JSON body and content type as before.
Removes nothing:
_CODE_SLOT_NOT_FOUNDwas a private name with no reader outsideprompts_caller_gates.pyand theTYPE_CHECKINGlist inhandlers/prompts.py(grep ofsrc/andtest/on origin/main; it is not in the frozen facade inventory); no handler, route or response field is removed.Tests
test/test_missing_slot_uniform_404.pyadds the fork handler's unknown-slot 404 and the skill gate's refusal of an app naming no slot, each pinned to the helper's status, body and content type.slot_ownership.pythat callsjson_responsewith{"error": "not found", "code": "slot_not_found"}(or a*SLOT_NOT_FOUNDname). Red on origin/main, namingchat_fork.py:291andhandlers/prompts_caller_gates.py:151; green here.test_chat_fork_error_codes.py::test_the_ratchet_can_actually_failcount updated to 26.scripts/local-gate.pyrelated set, black, isort, flake8, mypy, semgrep (semgrep/, diff-scoped), the flake-pattern ratchet, and local GPT and Opus review mirrors. All green on this head. A wider local run of the same refactor on the earlier base hittest_pid_lifecycle_teardown.py::TestResetStateUntracksParentPid::test_reset_state_untracks_parent_pid, which fails on clean origin/main on that host too, so it is not caused by this diff.Manual verification
N/A — unit coverage sufficient: each branch swaps a literal for a call returning an equal response, and the tests call both changed branches.
Related Issues
Closes #21576
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)