Repository navigation
feat(core): auto-background slow Code Mode executions - #60709
Open
kitlangton wants to merge 1 commit into
Open
kitlangton wants to merge 1 commit into
kitlangton wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Code Mode
executecalls now yield as a single background job after 10 seconds while keeping nested tool calls typed in foreground inside the script.Instead of rewriting inner
tools.*return types for backgrounding,executeitself runs throughexecuteTopLevel, streams liveconsole.loglines and nested call status into partial progress, delivers an<execute>notice when done, and exposes"tool"jobs to idle hooks and goals.💡 Why
tools.*calls insideexecutewould break every Code Mode script expecting typed return values."tool"jobs so a goal waits for a backgrounded Code Mode or MCP call before judging the round.🆕 Now you can
executescripts auto-background after 10 s (or viayield_after/background: true), returningconsole.logoutput and nested call progress so far and delivering<execute id="..." state="completed">even after location invalidation (shell: plugin suffix rebuild drops background completion notifications #56729)."tool"jobs inSessionIdleBackgroundand holdGoalPlugin.idleuntil they finish.📊 Numbers
executescript (> 10 s)tools.*stay typedexecute(#56729)Jobscope and delivers<execute>notice/goalwhile background tool runskind === "tool"noticeNew Code Mode auto-background test in
tool-auto-background.test.tsfails without this change; 146 tests pass acrosscodemode.test.ts,tool-auto-background.test.ts,job.test.ts,tool-image-generate.test.ts,session-execution.test.ts, andplugin/goal.test.ts.👀 Read:
packages/core/src/tool.ts(executeTopLevelname === "execute"branch) andpackages/core/src/plugin/goal.ts(idlewaiting onwork.kind === "tool"). The rest is routine.🔍 Split 6 of 6 from #60495 · closes out the #60495 split
Checks run
bun run --cwd packages/codemode typecheck && bun run --cwd packages/plugin typecheck && bun run --cwd packages/core typecheckbun --cwd packages/codemode test test/codemode.test.ts: 54 passbun --cwd packages/core test test/tool-auto-background.test.ts test/job.test.ts test/tool-image-generate.test.ts test/session-execution.test.ts test/codemode.test.ts test/plugin/goal.test.ts: 92 pass