🔦 fix: Log Why a Selected Subagent Could Not Start - #583
danny-avila wants to merge 1 commit into
Conversation
Both start-up failure paths returned a fixed sentence and logged nothing, so an operator could not tell an execution-identity failure from a host resolver rejection or an aborted child. Log the phase, the registered subagent type, whether the child signal was aborted, and the error's class, under the same no-quoting rule as the Code API diagnostics.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
When a selected subagent fails to start,
SubagentExecutorreturns a fixed sentence ("Unable to initialize the selected subagent.") and logs nothing. That's deliberate for the model, since resolver errors can carry host secrets. But it leaves operators with no record of which step failed.We hit this in production. A background PR-review subagent calls a nested verifier subagent. The nested calls failed in 4 of 5 runs, and in every failure the parent's foreground turn had already ended. Nothing in the logs said whether identity preparation failed, the host resolver rejected, or the child had been aborted.
This change logs one structured warning at each of the two start-up failure points. It follows the no-quoting rule in
src/tools/diagnostics.ts: every field is a value the SDK owns, or the host-registered subagent type. The error's text is never included.phaseidentity(execution identity/lease) orconfig(hostresolveAgentInputs, then the usability check)subagentTypetype, not the model's argumentabortedtypedescribeCodeApiErrorThe host still owns its own error text: a host that wants the message should log it where its resolver throws.
Changes
src/tools/subagent/diagnostics.ts:logSubagentResolutionFailureand a non-quoting error classifier.SubagentExecutor.ts: calls it from bothSUBAGENT_RESOLUTION_ERROR_MESSAGEcatch sites. The pre-commit Prettier/import-sort hook also reformatted a few existing lines in this file; those are formatting only.aborted: truepath.Testing
npx jest src/tools/subagent: 4 suites, 127 tests passed.npx jest src/tools/__tests__/subagentHooks.test.ts src/graphs src/run: 13 suites, 212 tests passed.npx tsc --noEmit: clean. ESLint: clean on the changed files.