Skip to content

fix(ci): measure agent context without changing the budget snapshot - #784

Merged
lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/budget-measured-in-ci
Nov 20, 2026
Merged

lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/budget-measured-in-ci

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Related to #751

Problem

Agent-facing text PRs update the same three totals, so independent changes can conflict on a generated file.

Change

  • The existing Agent context budget check runs the generator on GitHub’s proposed merge and its exact base. It reports three signed byte deltas and requires the maintainer’s agent-context-increase label for growth in any value.
  • Both revisions use a frozen server-only dependency install and share the existing pnpm cache. Label changes and retargets run the comparison again. Title and body edits leave the previous comparison result in place.
  • The nightly carry path regenerates the tracked snapshot after replay, using the dependencies already installed for validation. It folds the updated file into the sixth carry commit before recording the candidate. The recovery command still regenerates the snapshot after a repaired replay.
  • The upstream-owned workflow, test and JSON retain their paths. The unit test still guards which tools Claude loads up front.

Verification

  • Two independent tool-text edits reproduced the old JSON merge conflict and merged cleanly with the snapshot left to checkpoint regeneration.
  • The real generator and CI comparison rejected an unlabeled 3-byte increase, accepted it with the label, and passed an unlabeled 23-byte reduction.
  • Exact-branch Quick CI passed. All 50 checkpoint and carry tests and six budget and registration tests passed. Same-base carry compilation preserved the exact PR tree. A disposable replay onto an upstream JSON edit resolved only the existing derived-file conflict, then regenerated the correct snapshot.
  • The hosted check took 78 seconds versus 5 seconds for a recent run of the old check. Base checkout, installation and measurement took about 7 seconds on the new run. The two filtered installs reused cached packages with zero downloads.

Local review: 1 round with GPT-6.1 Terra (xhigh), approved.

GPT-6.2 Sol via Codex in LastCode

Competing text changes conflict when both commits update a shared byte snapshot. Compare source measurements from the proposed merge and its pinned base, with the existing maintainer label for growth.

Carry-Group: build-ci
Carry-Fix: #751

GPT-6.2 Sol via Codex in LastCode
Remove the checked-in snapshot equality assertion from PR tests. Keep the tool registration invariant and document how checkpoint regeneration and PR budget checks apply to text changes.

Carry-Group: incubator
Carry-Fix: #751

GPT-6.2 Sol via Codex in LastCode
Retargeting can change the comparison without a new head. Give title and body edits a separate skipped check to preserve the last budget result.

GPT-6.2 Sol via Codex in LastCode

Carry-Group: build-ci
Carry-Fix: #751
Let the completed carry tree regenerate its own context snapshot with the existing frozen install. Fold the file into the last carry group before recording the candidate used by smoke and publication.

GPT-6.2 Sol via Codex in LastCode

Carry-Group: build-ci
Carry-Fix: #751
Record where the checkpoint refreshes the derived budget in each flow.

GPT-6.2 Sol via Codex in LastCode

Carry-Group: incubator
Carry-Fix: #751
@lastobelus
lastobelus marked this pull request as ready for review November 20, 2026 08:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T08:40:40.677185Z 7035bb9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 7035bb9eb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit 953c243 into lastcode/main Nov 20, 2026
37 of 53 checks passed
@lastobelus
lastobelus deleted the lastcode/budget-measured-in-ci branch November 20, 2026 10:29
lastobelus added a commit that referenced this pull request Nov 21, 2026
## Problem

When an Action's process is lost (for example, an environment restart), its retained follow-up stays open and every saved Action in that thread is blocked. The composer has **Resume agent** and **Discard** buttons for this, but agents had no tool for it. An agent in that state could only report that it was stuck. Refs #681.

## What changed

- **Two caller-only MCP tools:** `resume_interrupted_action` and `discard_interrupted_action`. Both take no arguments and call the existing `ActionResume` service methods (`resumeInterrupted`, `discardInterrupted`).
  - **Resume** queues the retained result and follow-up, like **Resume agent**. It does not rerun the command. Resume now refuses when ended ownership disposes the retained follow-up instead of reporting false success. Delivery and rollback stay under the existing lock.
  - **Discard** drops the follow-up so new Actions can launch, like **Discard**. It does not record that the command succeeded.
- **Where each tool acts:** only on the calling thread's own Action. A mediated Action is recovered in the parent's thread and a child-owned one in the child's.
- **Blocked messages point to recovery:** the blocked `list_project_actions` reason and the `action_already_running` launch refusal now name the composer **Resume agent** / **Discard** and both tools. The `list_project_actions` tool description mentions both tools too.
- **Runbook:** a short section in `docs/internals/resumable-project-actions-setup.md`, "An interrupted Action blocks new launches", linked from the existing disabled-listing troubleshooting entry.
- **Evals:** three cases in `evals/mcp-tool-use/cases/action-resume.ndjson`: resume, discard then start a different Action, and an ordinary-work control.

## What stays the same

- **Availability:** recovery still works only while result delivery is available. It cannot clear a follow-up that is already running or pending.
- **Guards:** owner obligations and permission guards are unchanged.
- **Evidence:** `inspect_action_run` still shows the retained output and the lost outcome (`process_lost`).

## Not covered

- **#681 stays open.** This PR fixes manual recovery only. Automatic notification when a process is lost is a separate change.

## Context budget

The two recovery tools previously measured a 1505-byte catalog increase. CI now measures the proposed merge against its exact base; the `agent-context-increase` label is on the PR. This PR leaves the tracked budget snapshot unchanged for checkpoint regeneration.

## Validation

- **Regression tests:** the missing-tool regressions failed on base.
- **`ActionResume` suite:** 65 passed on the fix, including an owner-ended recovery case that failed before the review fix.
- **`vp run check:changed origin/lastcode/main`:** passed format, lint, knip, GraphQL and typecheck of 3 packages, plus 75 tests in 3 files.
- **Focused model evals** (3 cases × 3 samples, gpt-6.1-sol at xhigh; tool replies are simulated):

  | Case | Before | After |
  |---|---|---|
  | Interrupted-recovery cases | 0/6 | 6/6 |
  | Ordinary-work control | 3/3 | 3/3 |

- **Full MCP model eval:** completed on `23ecb669431114b7001ff40d10db8f0223727280` with GPT-6.1 Sol at high effort and GPT-6.1 Terra as shell simulator. All 328 cases ran in 82 shards: 669 samples, 616 passed, 53 failed, 0 errored; 306 cases passed and 22 failed by majority. The three added recovery/control cases passed 6/6, and no other case called either recovery tool. The failures concern existing workflow, preview, native-agent and routing expectations. The closest Action ownership and background-wait failures also fail by majority on base with the same checks; the ordinary Action-launch control passes 2/2 on both. No full-suite pass is claimed.
- **Local review:** finished with no blocker or should-level findings in the final round. Opus approved; Terra's two pre-existing persistence nits were moved to follow-ups.
- **Checkpoint replay:** exact same-base compiled tree passed at `25120a5c9afdb03061fc62768188e3085ce6155a..c356191`. The source commit stays in Incubator because its child-ownership lifecycle and eval fixtures arrive there.
- **Local Quick CI:** two optional attempts were blocked by base advancement; no local Quick CI pass is claimed. Exact-head GitHub CI and Codex review remain required.

Local review: 3 rounds with GPT-6.1 Terra (xhigh) and Claude Opus 5.5 (high), approved.

The six reviewed source, test, doc and eval files are byte-for-byte unchanged after replaying only this PR's two commits onto checkpoint base `79923ec1bac55be01b61588a09424021b093771e`. The budget snapshot matches the base, following #784. The scoped pre-push check passed on this head with 75 tests.

Nonblocking follow-ups from local review:

- F1: keep the conservative destructive hint for queued agent work; no permission change.
- F2: replay actual blocked-result wording in model eval fixtures.
- F3: make ended-owner refusal copy more specific.
- F4: pre-existing initial metadata-publication failure can leave delivery pending.
- F5: pre-existing accepted-dispatch/failed-save path can offer discard after queueing.
- F6: add direct failed-delivery rollback coverage beyond the busy/read-unavailable guard.

Implemented with GPT-6.1 Sol (xhigh) through the Codex harness; recovery wording by Claude Opus 5.5.

Carry-Source-Ref: refs/lastcode/carry-sources/pr-779/23ecb669431114b7001ff40d10db8f0223727280
Carry-Source-Base: 79923ec
Carry-Source-Head: 23ecb66
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