issue-306: Post the comment at runPipeline's no-code-change short-circuit #316
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-306/post-the-comment-at-runpipeline-s-no-code-change-s"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
306: Post the comment at runPipeline's no-code-change short-circuit
Closes #306 — 306.
Generated in 23m 58s.
Review findings
Now let me look at the resume machinery to evaluate finding 2, and the CLI/summary surfaces for finding 3.Let me examine the test file structure and the existing no-code-change tests, then the artifacts/resume helper APIs.Let me check remaining surfaces that might assert the current text/behavior (e2e, commit-model, runBatch), and inspect lint config for ternary/style constraints.Baseline verified via review. Now let me apply the fixes, starting with
runPipeline.ts(findings 1, 3, 4).Now update the type docstring inorchestrator.ts(finding 4's alternative branch), plus the summary docstring references:Now implement the resume mapping fix (finding 2 / Step 6) indetermineResumeStage.ts:Now the CLI outcome line (finding 3) inrunCli.ts:Now update the tests inrunPipeline.test.ts. Let me view the exact blocks to edit:Now add Step 6 tests todetermineResumeStage.test.ts. Let me inspect its helpers for the git-aware describe:Now add the CLI test (finding 3). Let me inspect the surrounding test helpers:Let me re-read the modified no-code branch to confirm coherence:Now run the targeted tests for the three touched test files:Targeted tests pass. Now run the full gates — lint, format check, full test suite, and build:Prettier hunk in runPipeline.ts is pre-existing on main (line 651 there), unrelated to this change. Now run the full gates:Typecheck shows errors; let me confirm none are new by comparing against the pristineorigin/mainbaseline in a temporary worktree:Clean: error locations are identical toorigin/main— no new typecheck errors. Let me clean up the temporary worktree and review the final diff:All gates green. Let me do a final review of the remediation diff:The diff is coherent. Let me sanity-check one existing resume no-code test that predates this feature, to ensure my skippedStages change didn't make its premise stale:All fixes are applied and gates pass. Final annotated findings:Review Findings — 306
Summary
All four findings were resolved in a single pass:
currentStage = 'write-back'is now set beforemakeCommentClient(...)so a client-construction failure (provider config/credential error) is attributed to thewrite-backstage, neverimplement. Added a unit test locking that attribution (attributes a comment-client construction failure to the write-back stage).determineResumeStage.tsnow hasisImplementStageComplete(validimplementation.diffor validno-code-change.json), used viaisStageArtifactCompleteindetermineResumeStartStage, theallArtifactsValidpre-check, and the git-trailer artifact check. Real resume after a fatal no-code-change failure now returnsreview(implement skipped), so the implement LLM never re-runs and the resume-re-entry unit test'sresumeFromStage: 'review'premise is real machinery output. Added three resume-machinery unit tests covering the valid-artifact, malformed-artifact, and git-aware paths.buildNoCodeChangeSummarynow renders a comment line when the post happened this run (and an "already posted" variant when the marker pre-existed on resume), and the CLIOutcome: no-code-change …line appends— commented on the issuewhennoCodeChangeCommentis set. Added runCli unit coverage. Batch/manifest intentionally unchanged (ADR-021 §8 / plan Step 5).'write-back'is only pushed when the post was actually skipped (marker pre-existed on resume); when the comment post runs, write-back ran and is not reported as skipped. Test expectations updated accordingly (posted-run lists now excludewrite-back; marker-skip test asserts it is included), and the no-code-change variant'sskippedStagesdocstring inorchestrator.tsnow states the condition.Gates:
npm testpassed (148 files / 2128 tests),npm run lintpassed,npm run buildpassed;npm run typecheckstill fails on the same error locations asorigin/main(verified by diffing normalizedtsc --noEmitlogs against a throwaway worktree oforigin/main— identical set, only the union-type message text now mentions the newnoCodeChangeCommentfield). Prettier still flags the pre-existing docs-stage hunk inrunPipeline.ts(confirmed present onorigin/main, untouched). GatedPILOOP_E2Eresume E2E (ADR-021 §9) not run — needs live creds. Remaining plan steps (AGENTS.md error-handling row, DESIGN.md artifact inventory — plan Step 9) are unchanged follow-up work.Critical
High
Medium
src/orchestrator/services/runPipeline.ts:561 —
currentStage = 'write-back'is assigned aftermakeCommentClient(...)runs, so if the comment client constructor throws (e.g. a provider config/credential error surfaced at construction —defaultMakeCommentClientcallsrequireJiraCreds/requireGitLabCredswhich throw), the catch block attributes the failure to'implement'(the current stage at that moment). That contradicts the branch's own comment and ADR-021 §5 ("Failures are FATAL … attributed to the write-back stage so error.json/console output name the real culprit rather than the implement stage") and would make resume targetimplement(re-running the implement LLM). Suggested fix: movecurrentStage = 'write-back';above themakeCommentClientcall (this is exactly what implementation-plan Step 4 §2 instructs).src/orchestrator/services/runPipeline.test.ts:2567 — the resume-re-entry test simulates
resumeFromStage: 'review', a state the real resume machinery cannot produce yet:determineResumeStage.ts:30still mapsimplementtoimplementation.diffwith nono-code-change.jsonspecial case (ADR-021 §7 / implementation-plan Step 6). A real fatal comment failure writeserror.json(stagewrite-back) but the run has noPi-Loop-Stagecommit and noimplementation.diff, so a subsequent resume falls back to artifact detection and returnsresumeFromStage: 'implement'— re-running the implement LLM, exactly what §7 forbids ("The implement LLM never re-runs"), and widening the residual duplicate-post window if the crash lands afteraddCommentbut before the marker write. Suggested fix: land Step 6 (isImplementStageCompletetreating a validno-code-change.jsonas implement-complete evidence, used indetermineResumeStartStageand theallArtifactsValidpre-check ofdetermineResumeStageWithGit) in this change or sequence it immediately after, and update the resume unit/E2E assertions to go through the realdetermineResumeStageentry point rather than fakingresumeFromStage: 'review'.Medium (continued from above)
noCodeChangeCommentresult field has no downstream consumer:runCli.ts'sOutcome: no-code-change …line andbuildNoCodeChangeSummary(runPipeline.ts:236) are not updated to mention the comment, so operators and the run summary still see no trace that the issue was commented on (ADR-021 §8). This matches implementation-plan Step 5 being split out, so it may be intentional — but if Step 5 is not already tracked as a follow-up issue, it should be, because the branch now performs the post silently from the operator's point of view. Suggested fix: add the follow-up (or extendbuildNoCodeChangeSummary/runCli outcome line in this change).Low
'write-back'intoskippedStagesand the new tests assert it, yet the branch now executes write-back work (the comment post is logged/attributed to thewrite-backstage at lines 566–575). The returnedskippedStages: ['review','remediate','docs','mr','write-back']tells consumers write-back was skipped when it ran. Suggested fix: drop'write-back'from the push when the post actually executes (only keep it for the marker pre-existed / skipped-post case), and update the test expectation accordingly — or, ifskippedStagesis deliberately informational, tighten the type docstring atorchestrator.ts:225so the claim is accurate.