Repository navigation
[codex] feat: add agent harness v2 lifecycle adapter - #71222
100yenadmin wants to merge 6 commits into
Conversation
Greptile SummaryThis PR introduces Confidence Score: 5/5Safe to merge — purely additive, no existing behavior changed, and all remaining open items are tracked in prior threads at P2 or lower. No new P0/P1 issues found. All three substantive concerns raised in previous review threads are open P2-level design suggestions. The core adapter logic is correct: delegation to runAttempt is identity-preserving, classification is properly isolated to resolveOutcome, and V1 hooks are faithfully re-exposed. Tests cover the three main code paths. No files require special attention. Reviews (2): Last reviewed commit: "feat: add agent harness v2 lifecycle ada..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bd9244c29
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Introduces an additive “Harness V2” lifecycle-shaped interface and a compatibility adapter so existing V1 AgentHarness implementations can be exercised through the V2 stages without changing runtime selection or migrating Pi/Codex execution yet.
Changes:
- Added
AgentHarnessV2contract (prepare/start/resume/send/resolveOutcome/cleanup) plus supporting types. - Added
adaptAgentHarnessToV2(...)to run existing V1 harnesses through the V2 lifecycle shape, preserving legacy hooks. - Added focused Vitest coverage for lifecycle forwarding, explicit outcome classification, and hook delegation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/agents/harness/v2.ts | Defines the V2 lifecycle contract and implements the V1→V2 adapter plus classification helper. |
| src/agents/harness/v2.test.ts | Adds tests ensuring adapter forwarding, explicit resolveOutcome classification, and legacy hook preservation. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9eb4585a71
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d61603eb2
ℹ️ 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".
|
Superseded by #71722, which consolidates the RuntimePlan/Harness package into one review PR and preserves this PR's commits via cherry-pick -x. Keeping this PR as review/history evidence. |
Summary
Follow-up to #71096 and RFC #71004. This PR adds the first additive Harness V2 lifecycle contract without migrating selection/execution yet.
No behavior change for existing harnesses.
RuntimePlan Package Context
This is the lifecycle foundation rung. RuntimePlan centralizes OpenClaw-owned policy; Harness V2 gives that policy a lifecycle-shaped execution boundary without redesigning the existing harness registry.
Review package links: #71196, #71197, #71201, #71220, #71222, #71223, #71224, #71238, #71239.
Local Architecture
Why This PR Exists
The existing harness SPI is intentionally small and should not be redesigned. The missing piece is an internal lifecycle boundary where OpenClaw can consistently attach RuntimePlan policy, telemetry, cleanup, and outcome classification. This PR adds that boundary additively and keeps V1 compatibility.
What Changed
src/agents/harness/v2.tswith an internal lifecycle-shaped harness interface.adaptAgentHarnessToV2(...)so existing V1 harnesses can run through the V2 shape.resolveOutcome(...)stage.compact,reset, anddisposecompatibility methods.Maintainer Review Guide
src/agents/harness/v2.ts,src/agents/harness/result-classification.ts,src/agents/harness/v2.test.ts.What Did Not Change
Verification
./node_modules/.bin/vitest run src/agents/harness/v2.test.ts --config test/vitest/vitest.agents.config.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json src/agents/harness/v2.ts src/agents/harness/result-classification.ts src/agents/harness/v2.test.tsgit diff --checkpnpm check:architectureLocal broad
pnpm check:changedhas previously hit unrelated repository type/dependency drift; focused Harness V2 tests and architecture checks are the intended merge signal for this slice.