fix(exec): derive agentId from sessionKey for allowlist lookup #1417
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
agents.mainwhen triggered via chat/DiscordcreateExecToolwas called without explicitagentId(e.g., frombash-command.ts), the allowlist lookup used"default"instead of deriving the agent fromsessionKeyagents.mainwere never matched, causing repeated approval promptsRoot Cause
In
bash-command.ts:333,createExecToolwas called withsessionKeybut NOTagentId:In
bash-tools.exec.ts, the allowlist lookup useddefaults?.agentId:With
agentIdundefined,resolveExecApprovalsFromFilefell back to:This looked up
agents.defaultinstead ofagents.main, missing all user allowlist entries.Fix
Derive
agentIdfromsessionKeyif not explicitly provided:Then use the derived
agentIdin all allowlist operations.Test plan
pnpm test src/agents/bash-tools.test.tspasses (16 tests)pnpm test src/infra/exec-approvals.test.tspasses (15 tests)agents.main🤖 Generated with Claude Code