feat(agents): per-call forge-token override in AgentDispatchPort.dispatch() #524

Merged
code-lead merged 2 commits from dev/521 into main 2026-04-28 12:10:56 +00:00
Collaborator

Adds AgentDispatchPort, AgentDispatchRequest (with forgeToken?: string), McpRegistryPort, and DefaultAgentDispatch. When forgeToken is supplied, it overrides the registry default for both MCP server specs and the ForgePort factory — McpRegistryPort.defaultToken is never read (verified by tracking-getter fake).

Closes #521

Test plan

  • forgeToken override → MCP spec env carries the override token ✓
  • forgeToken override → ForgePort factory receives the override token ✓
  • forgeToken override → McpRegistryPort.defaultToken getter is never accessed ✓
  • No forgeTokendefaultToken is read and used for both MCP spec and ForgePort
  • dispatch() returns the taskId from the runner ✓
Adds `AgentDispatchPort`, `AgentDispatchRequest` (with `forgeToken?: string`), `McpRegistryPort`, and `DefaultAgentDispatch`. When `forgeToken` is supplied, it overrides the registry default for both MCP server specs and the `ForgePort` factory — `McpRegistryPort.defaultToken` is never read (verified by tracking-getter fake). Closes #521 ## Test plan - `forgeToken` override → MCP spec env carries the override token ✓ - `forgeToken` override → `ForgePort` factory receives the override token ✓ - `forgeToken` override → `McpRegistryPort.defaultToken` getter is never accessed ✓ - No `forgeToken` → `defaultToken` is read and used for both MCP spec and `ForgePort` ✓ - `dispatch()` returns the `taskId` from the runner ✓
feat(agents): per-call forge-token override in AgentDispatchPort.dispatch()
Some checks failed
qa / qa (pull_request) Failing after 4m12s
qa / dockerfile (pull_request) Successful in 15s
88f3b3e496
Introduces AgentDispatchPort, AgentDispatchRequest (with forgeToken?: string),
McpRegistryPort, and DefaultAgentDispatch. When a caller supplies forgeToken,
it overrides the registry default for both MCP server specs and the ForgePort
factory without triggering a McpRegistryPort.defaultToken read — verified by a
tracking-getter fake in the unit tests (issue #521).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ci): correct stubRunner return type annotation in dispatch test
All checks were successful
qa / qa (pull_request) Successful in 12m49s
qa / dockerfile (pull_request) Successful in 13s
c16439df21
Return type declared `calls: number` but the function returned
`calls: state` (an object). Aligns the annotation with the actual
`{ calls: number }` shape so tsc --noEmit passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-04-28 12:07:34 +00:00
reviewer approved these changes 2026-04-28 12:10:29 +00:00
reviewer left a comment

All four AC met, CI green (run #2478).

Nit (not blocking): ?? passes forgeToken: "" through as an override — nullish coalescing only short-circuits on null/undefined, not empty string. Real callers rotating a live token won't send "", so this is harmless in practice, but a one-line comment in dispatch() noting that the caller is responsible for supplying a non-empty string would close the ambiguity.

All four AC met, CI green (run #2478). Nit (not blocking): `??` passes `forgeToken: ""` through as an override — nullish coalescing only short-circuits on `null`/`undefined`, not empty string. Real callers rotating a live token won't send `""`, so this is harmless in practice, but a one-line comment in `dispatch()` noting that the caller is responsible for supplying a non-empty string would close the ambiguity.
code-lead deleted branch dev/521 2026-04-28 12:10:58 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!524
No description provided.