Skip to content

feat(claimant): binding-aware intervention accounting in nudges (#1656 AC4) - #12859

Merged
dezren39 merged 1 commit into
mainfrom
lane-dq/1656-ac4
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-dq/1656-ac4

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Slice: #1656 AC4 — keeper state separates queue-session interventions

AC4: "Keeper state separates queue-session interventions from Jules/OpenChamber ones." Scope text: queue-session interventions are counted separately in the keeper state file so a burst of queue-session failures cannot silently consume the whole run's intervention budget; overflow is reported, not dropped.

In the current stack the interventions are nudges.py's actuations over babysitter verdicts (the keeper/babysitter pair was re-scoped to this conductor-side stack on 2026-11-13). nudge-state.json held only per-episode state — no aggregate counts, no budget separation.

What lands

  • Per-class counts in state: nudge-state.json gains a top-level counts: queue {nudges, escalations} for interventions on queue-bound sessions, other {observed} for unbound sessions (observed only, never driven). Counts accumulate across rounds and episode churn; a pre-counts state file reads as zeros — history the file does not carry is never invented.
  • Only applied actuations count: a failed send is not an intervention; an escalation that could not be noted is not one either.
  • Per-round queue cap with reported overflow: queue-class interventions are capped at MAX_QUEUE_INTERVENTIONS_PER_ROUND = 10 per round. Planned interventions past the cap land in the round record's overflow (with detail: over_queue_cap) and are deferred — episode state carries untouched, so they re-plan next round. The cap considers interventions least-served first (lowest nudges_sent, then session id), so a deferred session is served before the sessions that consumed budget ahead of it: overflow defers, it never starves.
  • Record shape: the nudge-step record gains interventions (this round per class + cumulative) and overflow, in live and shadow modes alike; shadow still mutates nothing.

Verification

  • New TestInterventionAccounting (5 tests): class separation + persistence, failed-send-not-counted, accumulation across rounds and episode close, burst overflow deferral with least-served-first service next round, shadow reporting without writes.
  • Negative control: all 5 new tests fail against origin/main's nudges.py.
  • Full package hermetic suite (run_hermetic_tests.py): 208 tests OK (includes the 43 nudges+babysitter tests).

Remaining on #1656

AC1 substrate landed 2026-11-22 (#12687/#12688/#12689); AC3 superseded by Drew's 2026-11-12 ruling. AC2 (an error-stopped queue session receives the standard retry/failover treatment, logged with its binding) is the remaining slice — the issue stays open for it.


Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…AC4)

nudge-state.json now carries cumulative per-class intervention
counts alongside the episodes: queue (nudges + escalations on
queue-bound sessions) separate from other (unbound sessions,
observed only). Only applied actuations count - a failed send
and an unnoted escalation are not interventions.

Queue-class interventions are capped per round at
MAX_QUEUE_INTERVENTIONS_PER_ROUND (10). Planned interventions
past the cap are overflow: reported in the round record and
deferred, never dropped - the episode state carries untouched
so the intervention re-plans next round. The cap considers
queue interventions least-served first (lowest nudges_sent,
then session id), so a session deferred by one burst is served
before the sessions that consumed budget ahead of it.

The nudge-step record gains `interventions` (this round per
class + cumulative) and `overflow`, in live and shadow modes;
shadow still mutates nothing. State files written before the
counts existed read as zeros.

Tests: TestInterventionAccounting (5 tests) in test_nudges.py -
class separation + persistence, failed-send-not-counted,
accumulation across rounds and episode close, burst overflow
deferral with least-served-first service next round, shadow
reporting without writes. Negative control: all 5 fail against
origin/main's nudges.py. Full hermetic suite: 208 tests OK.

Refs #1656 (AC4). AC2 (retry/failover for error-stopped queue
sessions) remains open on the issue.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1801f99b-f5bf-4fbe-98de-550073b066aa
Commits

Reviewing files that changed from the base of the PR and between 025483c and 9bbc9f4.

Files selected for processing: 2

  • pm-stack/opencode-claimant/nudges.py
  • pm-stack/opencode-claimant/test_nudges.py
  • 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

@dezren39
dezren39 merged commit b9c74ef into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-dq/1656-ac4 branch November 23, 2026 03:59
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