A desktop coding agent with free access to frontier models.
TypeScript
fix(engine): sub-agents take their model from the app, not from the model's own pick
Samrat Talukdar387d884f69f4
diff --git a/apps/server/src/opencode-plugins/omnirush-engine2.ts b/apps/server/src/opencode-plugins/omnirush-engine2.tsindex 01ea2d81..8e380957 100644--- a/apps/server/src/opencode-plugins/omnirush-engine2.ts+++ b/apps/server/src/opencode-plugins/omnirush-engine2.ts@@ -296,7 +296,22 @@ export default {// Sub-agents run in the foreground, as the 1.x task tool did (the swarm counts running// sub-agents and the task result carries the sub-agent's answer).await ctx.tool.hook("execute.before", async (event: any) => {- if (event.tool === "subagent" && isRec(event.input) && event.input.background === true) event.input = { ...event.input, background: false };+ if (event.tool !== "subagent" || !isRec(event.input)) return;+ // The sub-agent's model comes from the app's sub-agent setting (or the caller's), as with+ // the 1.x task tool, never from the model's own pick.+ const { model: _model, background: _background, ...input } = event.input;+ event.input = input;+ });+ // …so the subagent tool is offered without its `model` and `background` parameters.+ await ctx.session.hook("context", async (event: any) => {+ const input = event?.tools?.subagent?.input;+ if (!isRec(input) || !isRec(input.properties)) return;+ const { model: _model, background: _background, ...properties } = input.properties as Rec;+ event.tools.subagent.input = {+ ...input,+ properties,+ ...(Array.isArray(input.required) ? { required: input.required.filter((key: unknown) => key !== "model" && key !== "background") } : {}),+ };});const before = hooks("tool.execute.before");if (before.length) {