feat(settings): opt in to Code Mode for new tasks - #5219
Open
Astro-Han wants to merge 9 commits into
Open
Conversation
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Astro-Han
marked this pull request as draft
September 12, 2026 06:23
| isLabelHidden | ||
| value={props.codeModeEnabled} | ||
| isDisabled={savingRows["code-mode"] || !props.settingsInteractive} | ||
| onChange={(enabled) => void persistCodeMode(enabled)} |
Contributor
There was a problem hiding this comment.
Suggestion (non-blocking): Switch already supports an async changeAction and manages its optimistic/pending state internally. Passing persistCodeMode through that prop would let this row drop its savingRows["code-mode"] entry and keyed guard lifecycle (begin/set/reset/release), while preserving the existing error toast. That keeps the new setting from adding another copy of the manual save state machine.
Generated-by: Codex
Generated-by: Codex
Keep the VM alive during host waits and resume through the existing Promise bridge. Patch the executor at its synchronous VM boundary, remove idle polling and the guest-writable result slot, and preserve cancellation and resource limits. Generated-by: Codex
Astro-Han
marked this pull request as ready for review
September 12, 2026 07:39
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.
Summary
Add an opt-in Code Mode switch under Settings → General → Task defaults. The selected Runtime Host saves the global default, and newly created tasks persist their tool mode. Changing the switch leaves existing tasks unchanged; copies and child tasks inherit their source task's mode. Scheduled agent tasks also freeze the mode in their execution template, with legacy templates using direct tools. There is no per-task UI switch.
When enabled, the model receives only
exec, with the current callable tool catalog in its description. Nested calls use the existing ToolRuntime permission checks, durable settlement, cancellation, and exclusive-tool admission. Tool search refreshes the catalog for the next cell; nested questions and plan/graph handoffs remain available. Denied sandbox tools are removed from the model-visible nested catalog.Execution boundary
Keep
@ai-sdk/code-mode, upgrading 1.0.42 → 1.0.56 and aligning the AI SDK family and provider-utils patch. Pin itsrundependency to 2.1.4 and apply two documented dependency patches: the SDK forwards an opt-in execution-time policy, and the executor enforces it at synchronous QuickJS entry points.Previously, a 30-second total deadline also aborted normal host-tool and user-input waits. Maka now uses a cumulative 30-second VM execution budget. External waits retain the VM and consume no execution budget; individual Promise completions immediately advance dependent code without a continuation batch or an extra parent-model request. Default SDK wall-time behavior remains available and unchanged.
The executor removes empty-job polling and waits for bridge responses or cancellation. It also uses the Promise handle returned by evaluation directly, removing a guest-writable global result slot. Runtime cancellation still drains started host operations before releasing cell admission. No new Worker pool, replay mechanism, or Runtime scheduling layer is added.
The patched run manifest uses Maka's Node >=22.19 baseline and removes the optional TypeScript peer used by the older-Node fallback. Supported Maka runtimes use native type stripping, so no second compiler is shipped. Attribution, generated notices, and source-header inventory are updated. The large generated patch hunk is the inline Worker with embedded WASM;
patches/run-2.1.4-source.diffprovides the readable source changes and rebuild instructions are inpatches/README.md.Host protocol compatibility epoch moves from 142 to 143.
Verification
npm ci, dependency patch application, production dependency inspection, and SDK smoke passed. Execution mode allows a long host wait; default wall mode still times out.Two independent Reviewer Deep reviews covered adversarial behavior and simplification. No P0/P1 remains. Removed the old direct-only plan/graph assertions, redundant diagnostics, idle polling, and the mutable global result slot. Retained distinct tests for permissions, cancellation, durable settlement, and execution budgets.
Known limits
Waiting invocations retain their VM and Worker/memory quota until completion or cancellation. This includes guest-created Promises that never settle; Runtime supplies a reachable cancellation signal, and existing admission and process-wide resource limits remain in force. There is no automatic liveness deadline or deadlock detector. Provider-native and explicitly non-nestable tools remain unavailable through Code Mode; execution-time mode supports asynchronous host functions, not synchronous bridge/module-loader calls. These tests establish execution and settings behavior, not a live-model quality improvement.
AI use
Tool(s) and scope: Codex implemented dependency alignment, executor patches, settings/runtime integration, and tests. Two Reviewer Deep agents performed independent reviews.
Checklist
Does this PR entail a change in behavior?