Repository navigation
[codex] refactor: share harness terminal outcome classification - #71239
100yenadmin wants to merge 4 commits into
Conversation
Greptile SummaryThis PR extracts the terminal harness outcome classifier ( Confidence Score: 5/5Safe to merge — pure refactor with no behavioral changes and matching unit test coverage. All findings are P2 or lower. The extracted function is logically identical to the removed local one; types at the call site are compatible; the new SDK type is a proper superset of the removed local type alias; and tests cover all documented classification branches including in-flight, prompt-error, NO_REPLY, planning-only, reasoning-only, and empty. No files require special attention. Reviews (1): Last reviewed commit: "refactor: share harness terminal outcome..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR extracts Codex’s terminal harness outcome classification logic into the shared lightweight openclaw/plugin-sdk/agent-harness-runtime surface so that Codex and other harness adapters consume the same OpenClaw-owned policy that drives fallback behavior.
Changes:
- Added
classifyAgentHarnessTerminalOutcome(...)(and input type) to the plugin SDK runtime surface. - Added unit tests covering terminal classification scenarios (in-flight, prompt error, NO_REPLY, planning-only, reasoning-only, empty).
- Replaced Codex app-server’s local classifier with the shared SDK helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/plugin-sdk/agent-harness-runtime.ts |
Introduces the shared terminal-outcome classifier and its input type. |
src/plugin-sdk/agent-harness-runtime.test.ts |
Adds unit coverage for the new classifier behavior. |
extensions/codex/src/app-server/event-projector.ts |
Removes local classification logic and calls the SDK helper when building EmbeddedRunAttemptResult. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
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 moves terminal harness outcome classification out of the Codex app-server event projector and into the lightweight
openclaw/plugin-sdk/agent-harness-runtimesurface.Codex now consumes the same shared helper for
empty,reasoning-only, andplanning-onlyterminal turns instead of owning a local duplicate classifier.RuntimePlan Package Context
This is the outcome-policy ownership rung. Terminal classification is high-risk because it drives GPT-5 fallback behavior. The package goal is to make that policy OpenClaw-owned and shared before further Pi/Codex refactors.
Review package links: #71196, #71197, #71201, #71220, #71222, #71223, #71224, #71238, #71239.
Local Architecture
Why This PR Exists
The RuntimePlan/RFC path is about preventing Pi and Codex from silently forking OpenClaw-owned policy. Terminal outcome classification is one of the highest-risk policies because it decides whether GPT-5 empty/planning-only/reasoning-only terminal results can advance the fallback chain.
What Changed
classifyAgentHarnessTerminalOutcome(...)tosrc/plugin-sdk/agent-harness-runtime.ts.NO_REPLY), whitespace-only text, planning-only, reasoning-only, and empty outcomes.Maintainer Review Guide
src/plugin-sdk/agent-harness-runtime.ts,extensions/codex/src/app-server/event-projector.ts.NO_REPLYremains intentional silent output and does not trigger fallback.What Did Not Change
Verification
./node_modules/.bin/vitest run src/plugin-sdk/agent-harness-runtime.test.ts --config test/vitest/vitest.unit-fast.config.ts./node_modules/.bin/vitest run extensions/codex/src/app-server/outcome-fallback-runtime-contract.test.ts --config test/vitest/vitest.extensions.config.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json src/plugin-sdk/agent-harness-runtime.ts src/plugin-sdk/agent-harness-runtime.test.ts extensions/codex/src/app-server/event-projector.tsgit diff --checkpnpm check:architectureThis is one ownership-boundary extraction: Codex uses shared OpenClaw terminal outcome policy.