Repository navigation
feat: Let self subagents take host arguments through a resolver - #711
Conversation
A self config may now declare hostArgs together with resolveAgentInputs and a configId. Calls that pass host arguments resolve through the resolver with context.hostArgs; calls that pass none keep the provided agentInputs or the parent inputs. The resolved config stays self, so graphTools and compactionSemanticIndex are still dropped, and digest, binding and resume behave as for lazy configs. SELF_SUBAGENT_HOST_ARGS_SUPPORTED lets hosts feature-detect the shape. Every other config shape validates as before.
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. Hooray! 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. Keep it up! 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. 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". |
Why
LibreChat lets a parent agent pass per-call host arguments (
workspace,machine) to a subagent so the child runs its code tools in a chosen checkout on a paired machine. The SDK merges every subagent type's declaredhostArgsinto the onesubagenttool schema, so once any named child declaresworkspace, the model seesworkspaceas a parameter for every type, includingself.selfcould never accept it. In the last 14 days LibreChat's Lia agent got this tool result 15 times, each time while launching a background copy of herself in thelibrechatcheckout:LibreChat cannot fix this on its side. In 4.2.9, normalization rejects every shape that would let a
selfconfig receive host arguments:self+hostArgsself+hostArgs+ sanitizedagentInputsself+resolveAgentInputs+hostArgsBecause normalization runs while the parent graph builds its
subagenttool, addinghostArgsto the self config would break subagent setup for the whole run, not just one call.Change
A
self: trueconfig may now declarehostArgstogether withresolveAgentInputsand a non-emptyconfigId:agentInputs, otherwise the parent's own inputs. The resolver is not called.SubagentExecutor.resolveExecutionConfigcallsresolveAgentInputswithcontext.hostArgs, as it does for lazy configs. Before this change it skipped the resolver wheneveragentInputswas set; it now still skips it in every case except this one.self: true, soprepareChildInputsstill dropsgraphToolsandcompactionSemanticIndex.hostArgsDigestis recorded and checked the same way, a resume with matching arguments goes back through the resolver with the persisted execution id, and a resume with changed arguments is rejected with "Subagent invocation changed for this execution."configIdis the definition identity for every call to that config.SELF_SUBAGENT_HOST_ARGS_SUPPORTED(true) is exported from the package root, so hosts can attachhostArgstoselfonly on SDKs that accept it.Argument names are not special-cased; host arguments stay declared specs.
Compatibility
hostArgs,self+resolveAgentInputsstill throws "cannot combine self with resolveAgentInputs".hostArgson eager configs, with or without a resolver, and on graph configs still throws the existing errors. A lazy config keeps its existing messages.self+hostArgswithout a resolver, or without aconfigId.configIdon its self config changes that config's definition identity. Paused self executions recorded under the old identity will report "configuration changed" on resume, as with anyconfigIdchange.Tests
src/tools/subagent/__tests__/hostArgs.test.ts, newself subagent host argumentsblock:workspace;configId, and of self + resolver withouthostArgs;src/specs/subagent-host-args.test.ts: a fullRunwhere the parent's self config declaresworkspace. The routed call reaches the resolver; the call without the argument does not.The pre-commit hook runs Prettier over every staged file, so
SubagentExecutor.tsalso carries formatting-only changes to lines this PR does not otherwise touch.