Skip to content

fix: report command start failures instead of phantom exit 0 - #1

Open
matheusht wants to merge 1 commit into
thiago-ss:mainfrom
matheusht:fix/verify-command-start-failure
Open

fix: report command start failures instead of phantom exit 0#1
matheusht wants to merge 1 commit into
thiago-ss:mainfrom
matheusht:fix/verify-command-start-failure

Conversation

@matheusht

@matheusht matheusht commented Aug 10, 2026

Copy link
Copy Markdown

Summary

verify.ExecRunner.Run swallowed command start failures. When a command's binary does not exist (bad path, permission denied), cmd.Run() returns an error but cmd.ProcessState is nil, so the function returned (0, "", "", nil). Evidence gates then saw a phantom exit: 0 and passed checks that never actually ran.

That meant a misconfigured check/merge node (e.g. a typo'd binary name, or a tool missing on the worker) would silently pass corral's proof gates — directly undermining the "proof, not promises" guarantee.

Fix

  • ExecRunner.Run now returns the real error when the command never started (err != nil && cmd.ProcessState == nil). Legit non-zero exits and timeouts are unchanged (they set ProcessState).
  • startCheck / startMerge (scheduler) now surface a start failure through their evidence gates (exit 1 with the real error as stderr feedback) instead of returning an error that would bubble up and kill the run loop.

Tests

All four new regression tests fail on the previous code and pass with the fix:

  • TestExecRunnerReportsStartFailure — missing binary returns a real error, never a clean exit 0.
  • TestCommandGateDoesNotPassOnMissingBinary — command gate fails when the binary is absent.
  • TestCheckNodeFailsGateOnMissingBinary — scheduler check node lands failed (run settles, no phantom pass).
  • TestMergeFailsOnMissingVerificationBinary — scheduler merge node lands failed (run settles).

Verification

  • make test — all packages pass
  • go test -race — all packages pass
  • go vet ./... + gofmt — clean

Summary by CodeRabbit

  • Bug Fixes

    • Verification commands that cannot start now fail cleanly instead of being treated as successful.
    • Failed checks and merges are recorded accurately, including failed attempts and diagnostic details.
    • Runs continue through normal verification handling and settle without unexpected scheduler errors.
  • Tests

    • Added coverage for missing verification executables in checks, merges, and direct command verification.

ExecRunner.Run swallowed start failures (missing binary, bad path,
permission denied): when the process never started, ProcessState was nil,
so Run returned (0, "", "", nil). Evidence gates then saw a phantom
exit:0 and PASSED checks that never ran — a misconfigured check node
silently passed proof gates, defeating corral's evidence guarantee.

Return the real error when the command never started. startCheck and
startMerge surface the failure through their gates (exit 1 with the error
as feedback) instead of erroring the whole run.

Regression tests cover the ExecRunner primitive, the command gate, and the
check and merge scheduler paths; all fail on the previous behavior.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24055c49-1625-46c4-aadb-aafa174325f6

📥 Commits

Reviewing files that changed from the base of the PR and between 7d4acb5 and 399a680.

📒 Files selected for processing (5)
  • internal/sched/gates_test.go
  • internal/sched/sched.go
  • internal/sched/worktree_test.go
  • internal/verify/verify.go
  • internal/verify/verify_test.go

📝 Walkthrough

Walkthrough

Command startup failures now return execution errors from verification. Check and merge scheduler gates convert those failures into recorded failed results, allowing runs to settle. Regression tests cover missing binaries for direct verification, check nodes, and merge verification.

Changes

Verification and scheduling failure handling

Layer / File(s) Summary
Command-start error contract
internal/verify/verify.go, internal/verify/verify_test.go
ExecRunner.Run returns command-start errors with exit code 0. Verification tests confirm missing executables do not pass.
Scheduler gate failure handling
internal/sched/sched.go, internal/sched/gates_test.go, internal/sched/worktree_test.go
Check and merge launch failures become failed gate results with diagnostic stderr and exit code 1. Scheduler tests confirm runs settle with failed nodes and failed attempts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: thiago-ss

🚥 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 and concisely describes the main change: reporting command start failures instead of treating them as successful exit 0 results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@matheusht matheusht left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i like it

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