Repository navigation
feat(server): stop idle sessions that spend without delivery - #118
Merged
Merged
Conversation
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
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…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
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
Owner
Author
|
This merged into |
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.
Idle sessions could keep spending after the useful work stopped. This prices context-window updates and, by default, stops a thread once idle spend passes $50 or the session total passes $200. Flag mode only records the warning. Off disables it.
The provider reactor refuses the next automated turn when that ceiling is hit, and also when the thread still has the default title after its first turn or has no execution scope (an imported or legacy session). A background check records the flag or stop. A live turn is interrupted only when the session ceiling is crossed; an idle stop waits for the next turn so the interrupt checkpoint cannot clear the idle window. A linked pull request, a file-changing checkpoint, or a
spend-guard.releasedactivity starts the idle window over. Settled threads wake when the guard flags or stops them.Untitled and ownerless refusals apply to
cliand to a missing client surface.web,desktop, andmobilestay exempt. A compaction replay keeps the original client origin, so a human message queued behind compaction is not treated as automated.This is the idle-session spend guard for CLO-922.
Head
0d990dcd53cb56fd17768336a3a466b7b2e444b3.Review on
ae80a452936cd819f2c92c92ae1f95b85250a628(one round, not repeated):cliand a missing surface are refused; onlyweb,desktop, andmobileskip the untitled and ownerless checks.usagePriceOverrides, thensessionSpendGuard.fallbackRate. The turn path does not call LiteLLM, andUsageServicedoes not expose its rate table.spend-guard.released. That activity still resets spend if a server path writes it. Continuing after a ceiling stop means raisingsessionSpendGuard.sessionCeilingUsd. The refusal text no longer tells a person to append that activity.Verified on this head:
vp test run src/orchestration/SessionSpendGuard.test.ts(14 passed)vp test run src/orchestration/Layers/ProviderCommandReactor.test.ts -t "session ceiling"(2 passed, 82 skipped)Earlier on the previous head: the full provider reactor file (82 passed), contracts settings and settled decider tests, and
tsc --noEmitinapps/server(no errors; pre-existing suggestions only). Those were not re-run after this fix.Not verified: the integration suite, and there is no settings-form control for these fields yet. Operators can patch
sessionSpendGuardon server settings. Hosted CI (ci.yml) isdisabled_manually.closura-arc-ci.ymlonly runs onfeat/assemblyai-current, so this branch has no Actions run.Model: grok-4.7
Task: fix
Agent: grok
Lane: magpie
Harness: t3/codex
Model-family: Grok
Model-generation: 4.7