Skip to content

Propagate post-process container exit code#105

Merged
moodmosaic merged 1 commit into
protocol-security:masterfrom
simone-stacks:fix/launch-propagate-post-process-exit
Jun 8, 2026
Merged

Propagate post-process container exit code#105
moodmosaic merged 1 commit into
protocol-security:masterfrom
simone-stacks:fix/launch-propagate-post-process-exit

Conversation

@simone-stacks

Copy link
Copy Markdown
Contributor

Summary

  • cmd_post_process now propagates the post-process container's exit code instead of always returning success.
  • Harvest still runs unconditionally, so a crashed agent's in-flight commits are still recovered onto the local branch (best-effort).
  • On a non-zero exit, it warns that harvested commits may be partial state and returns the container's code.
  • Gives callers (CI workflows, daemons) a real signal to gate publish on, so partial state doesn't ship.

Changes

  • launch.sh: In cmd_post_process, capture docker inspect -f '{{.State.ExitCode}}' "$NAME" before harvest (falling back to 1 if inspect fails). Harvest still runs unconditionally; afterward, if the code is non-zero, log a warning to stderr and return "$exit_code". Previously the function swallowed the failure and returned success.
  • tests/test_launch.sh: Add section "42. cmd_post_process propagates container exit code", asserting the function captures State.ExitCode and returns $exit_code on failure. Documents the partial-output recovery contract (harvest runs, but the failure propagates).

Self-review checklist

  • This PR addresses a single concern (why?). If it covers multiple independent changes, I've split them into separate PRs.

Test plan

  • ./tests/test.sh --unit — 1357 tests pass, 0 failed (test_launch.sh: 223).
  • ./tests/test.sh --all — full integration matrix (Docker + API key); run in CI.
  • Behavior: a post-process container exiting non-zero causes cmd_post_process to harvest, warn on stderr, then return that exit code; a clean exit returns 0 as before.

@simone-stacks simone-stacks requested a review from moodmosaic as a code owner June 8, 2026 10:22

@moodmosaic moodmosaic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

container exit harvest exit process exit note
0 0 0 clean — unchanged
2 0 2 the PR's goal ✓
0 1 1 harvest failure still propagates (not masked) ✓
3 1 1 set -e aborts at the harvest line; harvest's code wins

The only behavioral change vs. the old code is exactly the intended one (row 2: container fails + harvest succeeds now propagates the container's code). Everything else is unchanged. Good, tight change. Thank you! 👍

@moodmosaic moodmosaic merged commit f82eeef into protocol-security:master Jun 8, 2026
5 checks passed
@moodmosaic

Copy link
Copy Markdown
Member

Released as 0.21.1.

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.

2 participants