Skip to content

feat(temporal): Let an operator bound what a turn and a session spend. - #22

Closed
moetemp wants to merge 1 commit into
moe/worktree-quarantinefrom
moe/turn-budget
Closed

moetemp wants to merge 1 commit into
moe/worktree-quarantinefrom
moe/turn-budget

Conversation

@moetemp

@moetemp moetemp commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

This PR lets an operator bound what a turn, and a whole session, may spend.

The model decides what to ask for, so the thing that says no has to sit where the model does not reach: the supervisor, between steps. OPENCODE_TEMPORAL_BUDGET_TOKENS and OPENCODE_TEMPORAL_BUDGET_SECONDS bound one turn and are checked after each step, so a step that has started is left to finish. OPENCODE_TEMPORAL_BUDGET_HARD_SECONDS is a deadline that stops the step that is running, which is what a user pressing stop does. OPENCODE_TEMPORAL_BUDGET_SESSION_TOKENS and OPENCODE_TEMPORAL_BUDGET_SESSION_SECONDS bound the session across every turn it runs: what a session spent is carried across a rollover and measured against the session's own row, so an idle session woken again does not get its allowance back.

The bound rides the workflow input like the mode does, because the sandbox cannot read env. A bound that is set but unreadable refuses to start rather than reading as none, and session doctor prints what was resolved. Off unless set, because a bound that ends real work is worse than none and only the operator knows which is which.

Tests: session-supervisor-ceiling.test.ts, drain-spend.test.ts, config.test.ts, and the spend cases in stepped-turn.test.ts and session-runner-model-call.test.ts.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

The model decides what to ask for, so the thing that says no has to sit where the model does not reach: the supervisor, between steps. `OPENCODE_TEMPORAL_BUDGET_*` set a turn's tokens and wall clock, a deadline that stops the running step, and the same two bounds for the whole session; what a session spent is carried across a rollover and read back off its own row, so an idle session woken again does not get its allowance back.
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant