Skip to content

Fix workflow initial-write exit arbitration - #1079

Merged
dennisonbertram merged 1 commit into
mainfrom
codex/issue-1076-workflow-initial-write-exit
Jul 31, 2026
Merged

Fix workflow initial-write exit arbitration#1079
dennisonbertram merged 1 commit into
mainfrom
codex/issue-1076-workflow-initial-write-exit

Conversation

@dennisonbertram

@dennisonbertram dennisonbertram commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Closes #1076

Summary

Preserves the truthful source-workflow failure when a child exits before the
parent can write the initial protocol message. Initial-write failures now enter
one bounded cleanup, stdin-close, process-wait, and outcome-resolution path
instead of returning raw EPIPE before the child is reaped.

Outcome precedence is explicit:

  • deadline remains first;
  • semantic protocol failure remains ahead of process/transport cleanup;
  • a genuine non-zero child exit and bounded stderr beat initial-write EPIPE;
  • when the parent's own cleanup SIGKILL causes Wait, the original initial-write
    error remains primary;
  • standalone initial-write and stdin-close failures remain visible;
  • successful results and missing-result behavior are unchanged.

Failure and strict red-green evidence

Hosted PR #1070 test-race run 30660042116 failed
TestSourceManagerRunWorkflowIncludesBoundedStderrOnProcessExit: expected
child stderr diagnostic, received write |1: broken pipe.

Two deterministic lifecycle reds then proved:

  1. a child can write stderr and exit 7 before the initial start write, while the
    old implementation returns EPIPE without waiting;
  2. a live child can close stdin, causing EPIPE, after which the parent's cleanup
    SIGKILL could mask the original transport error.

The final tests use FIFO/flock ordering rather than sleeps, assert the exact
error precedence, and prove both child PIDs are reaped.

Verification

Exact head: fa2f7c8ed6e576006d14ec6ec989ac2d6f1a5e91, rebased onto origin/main 34c0d8627558b13851ef81ec0d25c930c045b883.

  • Focused lifecycle/resolver normal stress, -count=100 — PASS.
  • Focused lifecycle/resolver race stress, -count=100 — PASS.
  • Complete internal/workflow normal and race suites — PASS.
  • Hosted-equivalent make test-race — PASS.
  • Foreground non-PTY ./scripts/test-regression.sh with Command Line Tools and isolated writable caches — PASS: normal, full race, coverage 85.6%, minimum 80.0%, zero uncovered functions.
  • Repository structure and git diff --check — PASS.
  • Independent cheap-tier exact-head review — APPROVED with no findings; focused acceptance/control set passed normal and race at -count=20.
  • Independent Sol exact-head review — no actionable findings.
  • Post-baseline-repair full exact-head regression — PASS: normal, full race, coverage 85.6%, zero uncovered functions.
  • The separate provider-key and swarm-test baseline repairs are merged through Stabilize provider API-key capture test #1053 and Stabilize swarm activation control lifecycle #1047; this branch is rebased cleanly above both.

Scope and rollout

This is a narrow source-workflow lifecycle/error-arbitration repair plus its
deterministic tests and required plan/impact/log documentation. No schema,
protocol, API, cron/callback, TUI, or macOS code changes. No migration or data
repair.

Roll back if deadline or semantic protocol errors lose precedence, a child is
not reaped, stderr becomes unbounded, successful workflows regress, or
standalone transport errors are hidden. After merge, PR #1070 will be rebased
onto the repaired main and its complete local and hosted gates rerun.

Checklist

  • Structured bug with complete acceptance criteria
  • Plan, impact map, indexes, and durable logs
  • Deterministic red-green lifecycle regressions
  • Focused normal/race stress
  • Full normal/race/coverage gate
  • Independent cheap and Sol review
  • Hosted test-fast and test-race green on this PR

@dennisonbertram
dennisonbertram force-pushed the codex/issue-1076-workflow-initial-write-exit branch from 5ec49fd to 8e6bffa Compare July 31, 2026 20:42
@dennisonbertram
dennisonbertram force-pushed the codex/issue-1076-workflow-initial-write-exit branch from 8e6bffa to fa2f7c8 Compare July 31, 2026 22:13
@cursor

cursor Bot commented Jul 31, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@dennisonbertram
dennisonbertram merged commit fa2f7c8 into main Jul 31, 2026
2 checks passed
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.

[Bug]: Workflow initial start write masks child exit stderr

1 participant