Repository navigation
fix(agents): reject invalid selectors before routing - #153387
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 20, 2026, 3:01 AM ET / 07:01 UTC (Revision 5). ClawSweeper reviewWhat this changesRejects invalid agent selectors before workspace selection and Gateway lookup, preserves deprecated SDK blank-input behavior, and updates regression coverage and documentation. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains necessary on current main. The latest commit resolves the previous SDK blank-selector compatibility blocker, and no actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherAgent selection maps request IDs and session keys to the agent that owns a workspace or conversation. Gateway requests pass that selection through session authorization before dispatch. flowchart TD
A[Agent ID and session key] --> B[Gateway input validation]
A --> C[Deprecated SDK adapter]
C --> D[Strict agent selection]
B --> D
D --> E[Invalid input error]
D --> F[Selected workspace or session]
F --> G[Session authorization and dispatch]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -18, Tests +77, Docs +3. Total +62 across 20 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep strict validation in the existing selection owner and preserve the shipped blank-input contract in the deprecated SDK adapter through its documented retirement window. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main can select main when workspace resolution receives an unrepresentable explicit ID, and treats blanks as omitted. The added owner and RPC regressions target those paths; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Reusing the existing strict normalizer and keeping compatibility translation in the existing SDK adapter addresses the defect without another selection owner or a storage migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b3f38e7e4ff. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Keep positive message and reply-dispatch fixtures on fully qualified main-agent identities so strict admission reaches their sanitization, mirroring, and cancellation assertions. Preserve rejection coverage and lifecycle expectations.
|
Merged via squash.
|
* fix(agents): reject invalid workspace agent selectors * fix(agents): preserve selector errors across callers * test(agents): qualify session keys in dispatch fixtures Keep positive message and reply-dispatch fixtures on fully qualified main-agent identities so strict admission reaches their sanitization, mirroring, and cancellation assertions. Preserve rejection coverage and lifecycle expectations. * test(transcripts): defer timing repair to main * fix(plugin-sdk): preserve blank selector compatibility
Related: #150153, #152895
What Problem This Solves
Run workspace selection could silently choose
mainfor a blank or unrepresentable explicit agent ID. Strict selection also exposed callers that manufactured empty IDs or reported malformed input as Gateway unavailability.User Impact
Workspace APIs reject invalid explicit IDs before choosing a workspace. Gateway requests with malformed session keys or unrepresentable agent IDs receive
INVALID_REQUESTbefore lookup or dispatch. Valid IDs, omitted selectors, and existing fixed-storeglobalownership retain their behavior. Deprecated Plugin SDK resolver aliases preserve blank-as-omitted input through their existing compatibility window; strict SDK and core selection reject supplied blanks. This is a preparatory split; canonical session-key storage migration remains separate.Why This Change Was Made
The existing selection owner validates raw selectors. A shared Gateway adapter returns normalized explicit IDs or client errors before store lookup, and status reporting reuses its already-resolved owner. Removing duplicate routing checks and the private workspace selection wrapper leaves production code 18 lines smaller. The existing deprecated SDK adapter prepares its optional agent ID once for both initial resolution and ambient fallback, preserving the shipped contract without relaxing core admission.
Caller fixtures use valid fully qualified keys. Main independently repaired the transcript provider-reload test timing in #142102; this PR leaves that file unchanged and retains the main fix when merged.
Evidence
UNAVAILABLEforagentId: "!!!"before the adapter repair.v2026.9.5source and documentation.