Skip to content

fix(quota): bound CLI todo diagnostics#2510

Merged
huangruiteng merged 6 commits into
mainfrom
codex/quota-output-budget-20260724
Jul 24, 2026
Merged

fix(quota): bound CLI todo diagnostics#2510
huangruiteng merged 6 commits into
mainfrom
codex/quota-output-budget-20260724

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • compact repeated agent todo diagnostic lanes in the default quota should-run CLI projection after the full decision is computed
  • preserve decision-relevant counts and bounded identities: selected/executable work, up to three unclaimed candidates, due or capability-blocked monitors, one monitor schedule-gap repair target, and up to three succession-warning todo ids
  • expose the full diagnostic projection through --include-todo-summary-detail
  • tighten quota output budgets and add scale plus Markdown/JSON semantic coverage

Qualification

  • representative live loopx-meta readback at head fc915448: full detail 102,868 bytes; compact default 68,048 bytes (33.9% reduction)
  • default JSON now retains unclaimed_open_count plus bounded unclaimed_priority_open_items; Markdown renders their todo ids
  • default and detail modes preserve exact interaction_contract, scheduler_hint, and selected_todo
  • focused pytest: 12 passed
  • loopx canary premerge --from-git-diff: passed, 17/17 selected checks, no failures or manual holds
  • public/private boundary scan: clean; no raw state, logs, credentials, or local paths committed

This is a bounded hot-path reduction. Repeated whole-backlog, current-agent duplicate, other-agent diagnostic, handoff, deferred, and completed-item lists remain on the explicit detail path; their decision-relevant counts stay hot.

@huangruiteng

Copy link
Copy Markdown
Owner Author

Resolved the succession-warning identity gap found in review.

Changed surfaces

  • The compact quota should-run projection now keeps up to three public-safe
    todo_ids for todo_succession_warning while full warning items remain on
    the detail path.
  • Markdown renders those bounded identities and retains the existing item-list
    fallback for unprojected payloads.
  • A semantic regression test proves count=4 renders concrete repair todo IDs
    instead of todo_ids=n/a.

Validation

  • Focused pytest: 10 passed.
  • Ruff: passed for all changed files.
  • Python compile: passed for all changed files.
  • loopx canary premerge --from-git-diff: 17 selected, 17 passed, 0 failures,
    0 warnings, 0 manual holds.
  • Public/private boundary scan and git diff --check: passed.

This coverage is sufficient because the change is limited to the CLI-only
projection and Markdown renderer, while the canary set exercises the broader
quota, scheduler, monitor, output-budget, and control-plane contracts.

…dget-20260724

# Conflicts:
#	tests/control_plane/test_cli_output_budget.py
@huangruiteng

Copy link
Copy Markdown
Owner Author

Updated after semantic review of the compact hot path.

Changed surfaces:

  • retained up to three unclaimed_priority_open_items in default JSON and rendered their todo ids in Markdown; the previous compact output exposed only unclaimed_open_count
  • retained one monitor_schedule_gap_items repair target and rendered its identity
  • preserved the earlier succession-warning identity repair
  • merged current main non-destructively; PR is mergeable at fc915448

Readback:

  • full detail: 102,868 bytes
  • compact default: 68,048 bytes
  • actual compact output shows the two current unclaimed todos with status, task class, priority, and action kind

Validation:

  • focused pytest: 12 passed
  • risk-based premerge: 17/17 selected checks passed, zero failures, zero manual holds
  • diff hygiene, changed Python compile checks, and public/private boundary scan passed

Coverage is sufficient for this PR because it proves both budget behavior and the identities needed for selection/repair while leaving repeated diagnostic lanes on the explicit detail path.

@huangruiteng

Copy link
Copy Markdown
Owner Author

Follow-up qualification: default Markdown identity parity

markdown is the CLI default (loopx/cli.py), while heartbeat and host integrations explicitly request JSON. JSON remains the machine-readable control-plane contract, but default Markdown is still a supported agent/operator interface and must remain actionable.

The current head therefore preserves bounded identity in both formats without duplicating the hot path:

  • selected work reuses the existing agent_lane_next_action identity and falls back to selected_todo only when that lane is absent;
  • agent_todo_next now reads the bounded executable lane and includes todo_id;
  • the first three unclaimed todos retain todo_id, status, priority, task class, and action kind;
  • due monitor, capability-blocked monitor, schedule-gap repair, and successor-warning identities remain bounded;
  • counts and interaction_contract remain visible.

The first draft added duplicate selected/executable lines and the base/head output differential rejected the growth. The revised renderer reuses existing lines instead of raising the budget.

Validation on head 59779472:

  • 12 passed: quota CLI projection and CLI output budget tests;
  • Ruff passed on the renderer and focused tests;
  • cli-output-budget-regression-smoke.py passed;
  • loopx canary premerge --from-git-diff passed: 17/17 selected checks, no failures, skips, warnings, or manual holds;
  • public/private scan and git diff --check passed.

This covers the changed quota projection, Markdown renderer, output-budget contract, and default/cold-path parity without expanding the output allowance.

@huangruiteng

Copy link
Copy Markdown
Owner Author

Residual projection qualification

Exact-head measurement against the live public-safe loopx-meta state showed that the compact agent_todo_summary was still 10,032 compact JSON characters.

The remaining duplication was concrete:

  • first_open_items retained three monitor objects (about 3 KB), while the first item was also present in the dedicated monitor_due_items lane;
  • every retained item repeated text as title and carried non-decision diagnostics such as generic update metadata.

Head 060228cc now:

  • removes generic first_open_items from the default projection and records it in the omitted-lane detail metadata;
  • keeps the bounded first_executable_items, unclaimed, due monitor, capability-blocked monitor, and schedule-gap lanes;
  • projects retained items through an explicit action/routing/monitor field allowlist;
  • leaves the full objects available through quota should-run --include-todo-summary-detail;
  • tightens the focused compact-payload ratchet from 10 KB to 7 KB.

Readback against the same state:

  • agent_todo_summary: 10,032 -> 6,093 compact characters;
  • full default payload: 55,931 -> 51,992 compact characters;
  • selected todo, executable candidate, unclaimed candidates, due monitor, counts, succession IDs, and interaction semantics remain present.

Validation:

  • focused pytest: 12 passed;
  • Ruff and git diff --check: passed;
  • CLI base/head output-budget differential: passed;
  • risk-based premerge canary: 17/17 passed, with no failures, skips, warnings, or manual holds.

@huangruiteng
huangruiteng merged commit 0c21897 into main Jul 24, 2026
1 check 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