Skip to content

feat(server): stop idle sessions that spend without delivery (release line) - #125

Merged
nullStack65 merged 5 commits into
release/native-0.1.10from
port/clo-922-release
Nov 20, 2026
Merged

nullStack65 merged 5 commits into
release/native-0.1.10from
port/clo-922-release

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The session spend guard (Linear CLO-922) was merged into the stale main in #118, which the fleet does not build, so it was not running anywhere. This PR ports its three commits onto release/native-0.1.10 (Linear CLO-941).

main uses the old orchestration/ reactors and the release line uses orchestration-v2, so most of the change had to be rewritten:

  • SessionSpendGuard prices each provider turn's token usage. Pull request links and checkpoints that changed files restart the idle window.
  • ProviderTurnStartService refuses a turn past the ceiling, the same way it refuses a mode above its limit.
  • SessionSpendGuardReactor writes the flagged and stopped notices, wakes a settled thread with thread.unsettled, and interrupts a live run only when it hits the ceiling.
  • The settings defaults and their Closura: comment are taken from feat(server): stop idle sessions that spend without delivery #118 unchanged.

Not carried over 1:1: the no-owner refusal (the release line has no thread execution scope) and the spend-guard.released activity. The commit bodies keep #118's original wording, so where they mention context-window pricing or execution scope, the list above is what this branch does.

Tests: SessionSpendGuard.test.ts and ProviderTurnStartService.test.ts pass (97), settings.test.ts passes (35), and six other turn-start suites pass (351). Typecheck passes for t3 and @t3tools/contracts. check:changed shows the same knip and AgentContextBudget failures that are already on the base.

Review round (claude-fable-5-2):

  • Fixed: the spend stop refused web and mobile turns too, so a thread past its limit could not run the turn that links a PR. It now refuses only automated turns, as the Closura: setting comment says. Standing bot threads stay subject to it, since that is the Crown shape CLO-922 targets. The new test fails before the fix and passes after; turn-start and spend-guard tests pass (98).
  • Known and accepted: spend is counted per completed provider turn, so it is checked at the next turn rather than mid-turn, and the live-run interrupt rarely fires. Models with no price override use the fallback rate, as in feat(server): stop idle sessions that spend without delivery #118.

Deploy: fleet

Model: claude-opus-5-5
Task: CLO-941 port the session spend guard (CLO-922) to the release line

🤖 Generated with Claude Code

nullStack65 and others added 3 commits November 20, 2026 04:47
Idle threads could keep spending after the useful work stopped. Price context-window updates and stop or flag a thread once idle spend or the session ceiling is crossed. Enforce is the default. The next automated turn is also refused on an untitled thread or one with no execution scope.

A linked pull request, a file-changing checkpoint, or a spend-guard.released activity starts the window over. Settled threads wake when the guard flags or stops them.

Model: grok-4.7
Task: feature
Agent: grok
Harness: t3/codex
(cherry picked from commit e86d9ed)
Ported-to: release/native-0.1.10 (CLO-941)
Model: claude-opus-5-5
Task: CLO-941 port CLO-922
Agent: magpie-port
Lane: magpie
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…equest

A standing manager can keep spending through status nudges and child callbacks after a real pull request, which resets the idle window. Cover that ceiling stop in the evaluator and in the provider reactor.

Model: grok-4.7
Task: feature
Agent: grok
Lane: magpie
Harness: t3/codex
Model-family: Grok
Model-generation: 4.7
(cherry picked from commit ae80a45)
Ported-to: release/native-0.1.10 (CLO-941)
Model: claude-opus-5-5
Task: CLO-941 port CLO-922
Agent: magpie-port
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The thread detail query capped activities at 500 rows, so a long manager thread could stay under the ceiling. Read every spend-guard activity, interrupt a live turn only for the ceiling, and keep untitled or ownerless refusals on cli and missing surfaces.

Model: grok-4.7
Task: fix
Agent: grok
Lane: magpie
Harness: t3/codex
Model-family: Grok
Model-generation: 4.7
(cherry picked from commit 0d990dc)
Ported-to: release/native-0.1.10 (CLO-941)
Model: claude-opus-5-5
Task: CLO-941 port CLO-922
Agent: magpie-port
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spend stop refused web and mobile turns too, so a thread past its limit
could not run the turn that links a pull request or changes files. The stop
now refuses only automated turns, as the setting describes, matching the
untitled-launch refusal.

Review finding from the CLO-941 port review of the session spend guard (CLO-922).

Model: claude-opus-5-5
Task: CLO-941 port the session spend guard (CLO-922) to the release line
Agent: magpie
Lane: magpie
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…/clo-922-release

# Conflicts:
#	apps/server/src/server.ts
@nullStack65
nullStack65 merged commit 7fb880d into release/native-0.1.10 Nov 20, 2026
3 checks passed
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