Skip to content

forge-pilot: R10 thin campaign adapter and fixed-candidate roundtrip qualification (P8) - #113

Merged
RecursiveIntell merged 2 commits into
mainfrom
rsi/p8-r10-campaign-adapter-20261130
Dec 1, 2026
Merged

RecursiveIntell merged 2 commits into
mainfrom
rsi/p8-r10-campaign-adapter-20261130

Conversation

@RecursiveIntell

Copy link
Copy Markdown
Owner

What this does

Adds the R10 campaign adapter (P8) to forge-pilot as a thin layer over existing owners, and its qualification test, campaign_fixed_candidate_roundtrip.

  • forge-pilot/src/campaign.rs (new). CampaignBinding is a versioned, closed (deny_unknown_fields) record with a blake3 digest. It binds the mission contract reference (contract:<64hex>) and kanban attachment id, carried as opaque references the Ares owner issues; the source-tree and fixture digests; the patch hash (same algorithm as the engine's); evaluator id and digest; dataset partition and digest; policy version and digest; and route id and digest. bind() builds it; verify() recomputes every digest from the actual inputs and returns a typed error on any mismatch.
  • Carried only through existing owners. The reference campaign-binding:<digest> is the exact ApprovalRecord.reviewed_artifact_refs entry, the executor request_id, the plan input and the bundle treatment description. There is no new table, schema or evidence store; the persisted review holds only existing owner types (case, plan, approval); it is re-read at admission only to re-verify the binding, and is never accepted as proof that an effect occurred. The change touches only campaign.rs, one lib.rs line and one new test file.
  • Pre-effect admission (admit_pre_effect) reads the persisted review back, recomputes the binding, requires the persisted case, plan and approval ids to equal the reviewed ids and the approval to carry exactly the binding reference, then lets the owners decide: approval_matches, policy_as_of, evaluate_policy, issue_execution_permit. The issued permit must carry the reviewed case, plan, scope and exact execution input. Within the adapter, permits come only from issue_execution_permit; it constructs none itself.
  • Reopen (reopen_run_state) reconstructs completed, failed, unknown (empty or torn result, or missing evidence) and never-started runs from disk, reusing the executor's readback, without re-running anything.

Qualification

campaign_fixed_candidate_roundtrip runs the real forge-executor binary on a fixed known-good and a fixed known-bad candidate after admission, then evaluation, canonical export and import, and a cold reopen with fresh store handles. The good candidate reopens intact; the bad candidate is kept as imported evidence, and the real forge_engine::promote refuses it (no promotion row).

Separate tests cover: changed patch, source, staged fixture, evaluator, mission reference, dataset, policy or route; wrong namespace or target; missing, unreadable or symlinked review; substituted approval; generated ids that differ from reviewed ids; an approval bound to another case or plan; a missing or substituted reviewed artifact; stale, not-yet-valid and expiry-less approvals; a policy not in force; owner refusals of the permit; empty, op-less and no-op patches (no gain, no promotion); duplicate import (idempotent, one import row); missing evidence (nothing imported, nothing promoted); and evidence from another campaign.

Evidence

On head ab70c9c (rebased onto main a4dfb91, the merge of #112 (promotion gated on retained executions); the adapter's diff has the same sha256 before and after the rebase):

  • cargo fmt --all -- --check and cargo clippy --locked -p forge-pilot --lib --bins --tests -- -D warnings: clean.

  • cargo test --locked -p forge-pilot -p forge-engine --lib --tests: 403 passed, 0 failed, 0 ignored.

  • Contract recipe (closed_loop_normalization_tests, loop_roundtrip_tests, verification_control_tests, campaign_fixed_candidate_roundtrip): all pass; campaign_fixed_candidate_roundtrip alone is 37 passed.

  • Mutation: 57 single-line mutants of campaign.rs, each killed by a named test, run against the final campaign test set on 6bedd08; sources restored byte-identical (sha256 3a78a8bf…, the same file at ab70c9c). Mutants were not re-run at ab70c9c; that commit changes only forge_executor_tests.rs.

  • A second commit (ab70c9c, test-only) addresses an intermittent ETXTBSY ("Text file busy") in forge_executor_tests.rs. The likely cause (inferred from the error, not instrumented): stub tools were written and then executed while a concurrent test fork could still hold the write fd. Stubs are now written to a temp name and renamed into place. cargo_fixture_selects_the_cargo_branch_not_python failed once this way on the rebased head with that file unchanged; after the change, 25 of 25 runs were clean.

These are local runs on one host; no hosted CI run existed for this head when this was written.

Scope and limits

  • The adapter decides nothing itself: approval, policy, permit and promotion stay with their owners. Its verdict helper only classifies the executor's own improvement and regression counts.
  • It does not verify the mission contract's contents; it carries and compares the reference the Ares owner issues.
  • No provider call, deployment or activation.

…qualification

Bind mission/source/fixture/patch/evaluator/dataset/policy/route identities
into a closed versioned CampaignBinding carried only through existing owners
(ApprovalRecord.reviewed_artifact_refs, executor request_id, bundle plan
description). Pre-effect admission reads the persisted review back, recomputes
digests, and mints the permit only via evaluate_policy -> issue_execution_permit.
Adds campaign_fixed_candidate_roundtrip with real forge-executor runs, cold
reopen, and per-witness negative tests.
…TBSY)

forge_executor_tests wrote each stub tool with fs::write + set_permissions and
then executed it. Under the parallel test runner a concurrent fork can inherit
the stub's still-open write fd, and Linux then refuses to exec the file with
ETXTBSY ('Text file busy'). cargo_fixture_selects_the_cargo_branch_not_python
failed this way once on the rebased P8 head with an unchanged test file.

Stubs are now written to a sibling temp name, made executable, and renamed
into place, so no fd ever holds the final path open for writing. Test-only.

Verified: forge_executor_tests 25/25 runs, 0 ETXTBSY; forge-pilot +
forge-engine --lib --tests 403 passed, 0 failed; fmt and clippy clean.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-01T00:38:52.066005Z
We couldn’t complete this review. Comment @codex review to try again.
ab70c9c PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@RecursiveIntell
RecursiveIntell merged commit c3f7ca2 into main Dec 1, 2026
14 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