fix(acp): align unauth tenantId fallback with SYSTEM_TENANT (#3237)#3239
Merged
Conversation
acpBackend.createSession stores the session under SYSTEM_TENANT
('_system') when req.tenantId is undefined, but four sendPrompt call
sites fell back to the literal 'system'. The lookup missed every time
the request didn't carry an authenticated tenant, breaking every
ACP-routed prompt and /send/command in auth-disabled mode.
Routes affected:
- POST /v1/sessions (initial prompt + idle-reuse branch)
- POST /v1/sessions/:id/send
- POST /v1/sessions/:id/command
Closes #3237
Contributor
There was a problem hiding this comment.
Approved -- critical bug fix, all 9 merge gates pass.
Root cause: 4 sendPrompt() call sites used ?? 'system' but createSession() uses SYSTEM_TENANT ('_system'). The mismatch broke every unauthenticated ACP prompt delivery — this is the dogfooding blocker.
Fix: Replace all 4 fallbacks with SYSTEM_TENANT constant + add missing import. 2 files, 5 additions, 4 deletions.
All CI green. Locally validated with two-round trip. Pre-existing gate failures documented as unrelated.
This is the fix that makes ACP actually work for the dev team. Ship it.
OneStepAt4time
added a commit
that referenced
this pull request
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
acpBackend.sendPrompt(...)call sites to use theSYSTEM_TENANTconstant ('_system') as the unauth fallback, matching theacpBackend.createSession(...)create scope. Previously they fell back to the literal'system', so the lookup missed and prompt delivery failed for every ACP-routed request without an authenticated tenant.POST /v1/sessions(initial prompt + idle-reuse branch),POST /v1/sessions/:id/send,POST /v1/sessions/:id/command.SYSTEM_TENANTimport tosrc/routes/session-actions.ts.Closes #3237
Reproduction (before fix)
ACP child + Claude CLI spawn correctly; only the JSON-RPC
session/promptlookup fails because the scope doesn't match the create-time scope.After fix (locally validated)
Two-round trip on
develop+ this patch, with Claude Code 2.1.139:Test plan
AEGIS_DISABLE_AUTH=true,POST /v1/sessionswith a prompt returnspromptDelivery.delivered: trueand the JSONL transcript contains the assistant reply.POST /v1/sessions/:id/sendandPOST /v1/sessions/:id/commanddeliver in the same unauth path.req.tenantIdand are unchanged.Gate notes (pre-existing, not introduced here)
npm run gatefails ondashboard:tokens:gateanddashboard:clickable:gateagainst pristineorigin/develop@613fc30, and on three unrelated test files (config-yaml.test.ts,server-core-coverage.test.ts,e2e/e2e-dogfood.test.ts). All three are unrelated to ACP /sendPrompt/routes/sessions.*. Confirmed by running on pristineorigin/developwithout this patch.This PR's changed paths (
src/routes/sessions.ts,src/routes/session-actions.ts) passtsc --noEmitandnpm run buildcleanly.Aegis version
Developed with: v0.6.7-preview.1