Skip to content

(MOT-4295) test(harness): multi-target integration scenarios INT-014 and INT-016 plus runner enablers - #665

Open
ytallo wants to merge 1 commit into
mainfrom
feat/harness-integration-scenarios-wave1
Open

(MOT-4295) test(harness): multi-target integration scenarios INT-014 and INT-016 plus runner enablers#665
ytallo wants to merge 1 commit into
mainfrom
feat/harness-integration-scenarios-wave1

Conversation

@ytallo

@ytallo ytallo commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Part of MOT-4295 (coverage initiative). Two new integration scenarios aimed at the coldest harness modules identified by the stack coverage report, plus the runner capabilities they required.

Runner enablers

  • Probe responses in evidence: probe actions now record {function_id, response} into RunEvidence.probe_responses (with expect_probe_response), unlocking body assertions for state/ledger/teardown reads. Additive; existing scenarios unchanged.
  • Scripted hooks: fixtures can declare probe-hosted hook functions (Continue/HoldOnce/Deny/Mutate) bound to harness::hook::<point> trigger types before Send, with whole-run hook_calls evidence.
  • Send gains max_total_tokens; terminal statuses may now end in failed (the floor pins the durable status to it).

Scenarios

  • INT-014 budget-preflight-exceededbudget.rs (prepare/reserve/reconcile/rollback + Exceeded) and turn_loop::finalize_failed: a frozen 30k budget admits generation 1, then a ~240k-char controlled-function result deterministically blows generation 2's reservation (no system-prompt calibration needed). Asserts the failed terminal turn, the harness.budget_exceeded custom error entry, and the harness_budget ledger via a recorded probe response.
  • INT-016 notify-grant-teardownsubscriptions/notify_agent.rs, functions/filesystem.rs + filesystem_grants.rs, budget happy path, and teardown.rs/reconcile::sweep_owner: a state fire lands a trigger_fired entry plus the injected [notification: …] message that seeds the second tracked turn; grant→grants→revoke round-trip; ledger holds the exact reconciled usage (39 tokens); harness::teardown sweeps both standing bindings.

Bug found: MOT-4296

INT-013 held-call-resolve is authored but NOT registered. Running it exposed an apparent harness defect: after a pre_trigger hook answers hold, harness::status times out at the engine and the turn record disappears from state, so harness::function::resolve can never find the parked call. Isolation runs prove the scripted-hook plumbing is sound (the Continue variant completes in ~2.7s with both hooks served). The fixture + its HeldCallResolve intervention are complete and will verify the fix end to end — registering it is a 3-line diff once MOT-4296 lands.

Verification

  • All 14 registered direct scenarios pass against the local engine (full-suite run, zero regressions on the existing 12).
  • 92 unit tests pass (cargo test -p harness-integration), including new coverage for groupRunFailures-style fixture wiring, hook validation, and the fixture registry counts.
  • Zero build warnings.

Summary by CodeRabbit

  • New Features

    • Added integration coverage for token-budget preflight failures and notification/grant teardown flows.
    • Added configurable hooks supporting filtering, priorities, timeouts, holding, denial, mutation, and continuation.
    • Added held-call resolution testing and intervention support.
    • Added evidence for probe responses and hook activity.
    • Added optional maximum token-budget configuration.
  • Documentation

    • Documented new integration scenarios and the known limitation affecting INT-013.

…and INT-016 plus runner enablers

Two new scenarios aimed at the coldest harness modules found by the
coverage report, plus the runner capabilities they needed:

- probe actions now record their responses into RunEvidence
  (probe_responses + expect_probe_response), unlocking body assertions
  for state/ledger/teardown reads
- scripted hooks: fixtures can declare probe-hosted hook functions
  (Continue/HoldOnce/Deny/Mutate behaviors) bound to harness::hook::*
  trigger types before Send, with whole-run hook_calls evidence
- Send options gain max_total_tokens; terminal statuses may now end in
  'failed' (floor already pins the durable status to it)

INT-014 budget-preflight-exceeded: a frozen budget admits generation 1,
then a ~240k-char controlled-function result deterministically blows
generation 2's reservation — failed turn, harness.budget_exceeded
custom error entry, and the harness_budget ledger asserted through a
recorded probe response (reconcile + rollback).

INT-016 notify-grant-teardown: two standing notify subscriptions; a
state fire lands a trigger_fired entry plus the injected
'[notification: …]' user message that seeds the second tracked turn;
filesystem grant/grants/revoke round-trip; the budget ledger holds the
exact reconciled usage; harness::teardown sweeps both bindings.

INT-013 held-call-resolve is authored but NOT registered: running it
exposed an apparent harness defect — after a pre-trigger hook hold,
harness::status times out and the turn record vanishes from state, so
the resolve intervention can never find the parked call. Isolation runs
prove the scripted-hook plumbing is sound (Continue variant completes
in ~2.7s with both hooks served). See the scenario doc comment.

All 14 registered direct scenarios pass against the local engine;
92 unit tests pass; zero build warnings.
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview Aug 1, 2026 12:23pm
workers-tech-spec Ready Ready Preview Aug 1, 2026 12:23pm

Request Review

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 51 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The integration harness adds scripted hook configuration and execution, captures probe and hook evidence, supports held-call resolution, adds optional token-budget compilation, and introduces INT-014 and INT-016 scenarios.

Changes

Integration harness extensions

Layer / File(s) Summary
Hook and scenario configuration contracts
harness/tests/integration/src/fixtures/*, harness/tests/integration/src/scenarios/dsl.rs, harness/tests/integration/src/types/scenario/compiled.rs
Adds hook definitions, hook behaviors, held-call interventions, hook validation, and optional max_total_tokens compilation.
Hook runtime and evidence capture
harness/tests/integration/src/probe.rs, harness/tests/integration/src/scenario/*, harness/tests/integration/src/evidence_data.rs, harness/tests/integration/tests/determinism.rs
Registers and binds dynamic hooks. Captures probe responses and hook calls in RunEvidence.
Held-call resolution workflow
harness/tests/integration/src/scenario/phases/intervention.rs, harness/tests/integration/src/scenarios/held_call_resolve.rs
Validates parked function calls, exercises invalid resolutions, and resolves the target call.
Budget, notification, and teardown scenarios
harness/tests/integration/src/scenarios/*, harness/tests/integration/README.md, harness/tests/integration/src/fixtures/tests.rs
Adds INT-014 and INT-016, registers them in fixture selection, and documents the unregistered INT-013 defect.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ScenarioDSL
  participant ScenarioProbe
  participant HarnessHook
  participant RunEvidence
  ScenarioDSL->>ScenarioProbe: configure and bind scripted hooks
  ScenarioProbe->>HarnessHook: invoke hook behavior
  HarnessHook-->>ScenarioProbe: return response and record call
  ScenarioProbe->>RunEvidence: publish probe and hook evidence
Loading

Possibly related PRs

Poem

A rabbit hops through hooks in flight,
Captures each response crisp and bright.
Held calls wait, then spring anew,
Budgets count what turns pursue.
New scenarios join the run—
Test trails bloom beneath the sun.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the two added integration scenarios and the supporting runner changes.
Docstring Coverage ✅ Passed Docstring coverage is 86.96% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/harness-integration-scenarios-wave1

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
harness/tests/integration/src/scenarios/held_call_resolve.rs (1)

1-11: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Declare the module so the fixture keeps compiling.

This file has no mod declaration in harness/tests/integration/src/scenarios/mod.rs. Rust therefore never compiles it. The scenario() builder and the fixture_holds_and_resolves_one_call test are both inert, and the hook plumbing they exercise stays unverified. The fixture will drift out of sync with the DSL until MOT-4296 is fixed.

Declare mod held_call_resolve; and keep the fixture out of all(). The compiler then checks the builder chain, and the unit test runs on every cargo test.

♻️ Proposed change in harness/tests/integration/src/scenarios/mod.rs
+// INT-013 is authored but withheld from `all()` until MOT-4296 is fixed.
+// The module stays declared so the fixture and its unit test keep compiling.
+mod held_call_resolve;

After that change, you can also drop the #[allow(dead_code)] on Scenario::hook in harness/tests/integration/src/scenarios/dsl.rs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harness/tests/integration/src/scenarios/held_call_resolve.rs` around lines 1
- 11, Declare the held_call_resolve module in the scenarios module file so its
scenario builder and test compile and run, but do not include it in all(). After
registering the module, remove the now-unnecessary #[allow(dead_code)] attribute
from Scenario::hook in the DSL.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@harness/tests/integration/src/scenarios/notify_grant_teardown.rs`:
- Line 157: Update the comments near the trigger teardown fixture, including the
comment above the durable trigger_fired assertion and the earlier subscription
comment, to remove stale “once” and “retired once-sub” wording. Describe the
binding consistently with its declared once: false and retired: false state,
without changing the subscription setup or assertions.

---

Nitpick comments:
In `@harness/tests/integration/src/scenarios/held_call_resolve.rs`:
- Around line 1-11: Declare the held_call_resolve module in the scenarios module
file so its scenario builder and test compile and run, but do not include it in
all(). After registering the module, remove the now-unnecessary
#[allow(dead_code)] attribute from Scenario::hook in the DSL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 43de1535-1221-4af7-b8a7-805407f5b83a

📥 Commits

Reviewing files that changed from the base of the PR and between 12700ae and c02732a.

📒 Files selected for processing (19)
  • harness/tests/integration/README.md
  • harness/tests/integration/src/evidence_data.rs
  • harness/tests/integration/src/fixtures.rs
  • harness/tests/integration/src/fixtures/loading.rs
  • harness/tests/integration/src/fixtures/tests.rs
  • harness/tests/integration/src/probe.rs
  • harness/tests/integration/src/scenario/floor.rs
  • harness/tests/integration/src/scenario/phases/arm.rs
  • harness/tests/integration/src/scenario/phases/completion.rs
  • harness/tests/integration/src/scenario/phases/evidence.rs
  • harness/tests/integration/src/scenario/phases/intervention.rs
  • harness/tests/integration/src/scenario/state.rs
  • harness/tests/integration/src/scenarios/budget_preflight_exceeded.rs
  • harness/tests/integration/src/scenarios/dsl.rs
  • harness/tests/integration/src/scenarios/held_call_resolve.rs
  • harness/tests/integration/src/scenarios/mod.rs
  • harness/tests/integration/src/scenarios/notify_grant_teardown.rs
  • harness/tests/integration/src/types/scenario/compiled.rs
  • harness/tests/integration/tests/determinism.rs

.verify(|run| {
run.expect_assistant_texts(["armed", "acknowledged"])?;

// The fire left a durable trigger_fired entry for the retired once-sub.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the stale once wording in two comments.

Both subscriptions are declared with once: false, and the assertion at lines 175-180 requires once == false and retired == false. The comment on line 157 calls the binding a "retired once-sub", and the comment on lines 69-70 calls it "the once subscription". Both contradict the fixture and the assertion.

📝 Proposed comment fixes
-    // Turn 1 done: trip the once subscription's key. The notify fire injects
-    // the user message that seeds turn 2.
+    // Turn 1 done: trip the standing subscription's key. The notify fire
+    // injects the user message that seeds turn 2.
-        // The fire left a durable trigger_fired entry for the retired once-sub.
+        // The fire left a durable trigger_fired entry, and the standing
+        // subscription stayed live.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harness/tests/integration/src/scenarios/notify_grant_teardown.rs` at line
157, Update the comments near the trigger teardown fixture, including the
comment above the durable trigger_fired assertion and the earlier subscription
comment, to remove stale “once” and “retired once-sub” wording. Describe the
binding consistently with its declared once: false and retired: false state,
without changing the subscription setup or assertions.

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