Repository navigation
[codex] refactor: extract attempt transcript policy resolver - #71223
100yenadmin wants to merge 4 commits into
Conversation
Greptile SummaryThis PR extracts the transcript policy resolution logic from Confidence Score: 5/5Safe to merge — pure extraction with no behavior change and tests covering both code paths. The refactored call in No files require special attention. Reviews (2): Last reviewed commit: "refactor: extract attempt transcript pol..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR extracts transcript policy resolution from the embedded attempt runner into a focused resolver function with targeted unit tests, as a small “contract-domain split” aligned with the ongoing RuntimePlan work.
Changes:
- Added
resolveAttemptTranscriptPolicy()in a new module to centralize RuntimePlan-first transcript policy resolution with legacy fallback. - Updated
runEmbeddedAttempt()to use the new resolver instead of inlining the fallback chain. - Added tests covering RuntimePlan precedence and legacy (non-RuntimePlan) fallback behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/agents/pi-embedded-runner/run/attempt.ts |
Replaces inline transcript policy selection with the extracted resolver call. |
src/agents/pi-embedded-runner/run/attempt.transcript-policy.ts |
Introduces the new transcript policy resolver (RuntimePlan-first, legacy fallback). |
src/agents/pi-embedded-runner/run/attempt.transcript-policy.test.ts |
Adds unit tests for resolver precedence and fallback behavior. |
|
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 is the first small contract-domain extraction from the embedded runner monolith: transcript policy resolution moves behind a focused resolver with tests.
Runtime behavior is intended to be equivalent.
RuntimePlan Package Context
This is the first "split by contract domain" rung. It deliberately extracts only transcript policy resolution, not the whole
attempt.tsfile, because the package is trying to avoid cosmetic mega-splits before behavior ownership is clear.Review package links: #71196, #71197, #71201, #71220, #71222, #71223, #71224, #71238, #71239.
Local Architecture
Why This PR Exists
attempt.tsis too large to safely split mechanically while policy is still scattered. This PR extracts one contract-owned decision point and proves the RuntimePlan-first/legacy-fallback behavior in isolation. That gives maintainers a small, reviewable example of the intended runner split style.What Changed
run/attempt.transcript-policy.ts.run/attempt.ts.Maintainer Review Guide
src/agents/pi-embedded-runner/run/attempt.transcript-policy.ts,src/agents/pi-embedded-runner/run/attempt.ts.What Did Not Change
Verification
./node_modules/.bin/vitest run src/agents/pi-embedded-runner/run/attempt.transcript-policy.test.ts --config test/vitest/vitest.agents.config.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json src/agents/pi-embedded-runner/run/attempt.ts src/agents/pi-embedded-runner/run/attempt.transcript-policy.ts src/agents/pi-embedded-runner/run/attempt.transcript-policy.test.tsgit diff --checkpnpm check:architectureLocal broad
pnpm check:changedhas previously hit unrelated repository type/dependency drift; focused transcript-policy tests and architecture checks are the intended merge signal for this slice.