Skip to content

code_mode: Move exec params from runtime declarations to @pragma#14511

Merged
cconger merged 6 commits intomainfrom
cconger/drop-set-yield
Mar 13, 2026
Merged

code_mode: Move exec params from runtime declarations to @pragma#14511
cconger merged 6 commits intomainfrom
cconger/drop-set-yield

Conversation

@cconger
Copy link
Copy Markdown
Contributor

@cconger cconger commented Mar 12, 2026

This change moves code_mode exec session settings out of the runtime API and into an optional first-line pragma, so instead of calling runtime helpers like set_yield_time() or set_max_output_tokens_per_exec_call(), the model can write // @exec: {"yield_time_ms": ..., "max_output_tokens": ...} at the top of the freeform exec source. Rust now parses that pragma before building the source, validates it, and passes the values directly in the exec start message to the code-mode broker, which applies them at session start without any worker-runtime mutation path. The @openai/code_mode module no longer exposes those setter functions, the docs and grammar were updated to describe the pragma form, and the existing code_mode tests were converted to use pragma-based configuration instead.

@cconger cconger requested a review from pakrym-oai March 12, 2026 20:39
initial_yield_timer: null,
initial_yield_triggered: false,
max_output_tokens_per_exec_call: DEFAULT_MAX_OUTPUT_TOKENS_PER_EXEC_CALL,
max_output_tokens_per_exec_call: maxOutputTokensPerExecCall,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does JS need to know about this value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently disconnecting is managed in the cjs level so I think when we implement this I would expect it to be done in the top level js context.

Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@cconger cconger force-pushed the cconger/drop-set-yield branch from be92973 to 924f7a8 Compare March 12, 2026 22:35
@cconger cconger enabled auto-merge (squash) March 12, 2026 22:37
@cconger cconger disabled auto-merge March 12, 2026 22:45
@cconger cconger force-pushed the cconger/drop-set-yield branch 2 times, most recently from 0244d0c to 03494d1 Compare March 13, 2026 00:44
@cconger cconger enabled auto-merge (squash) March 13, 2026 02:34
@cconger cconger merged commit 0daffe6 into main Mar 13, 2026
32 checks passed
@cconger cconger deleted the cconger/drop-set-yield branch March 13, 2026 03:27
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants