Skip to content

fix(ci): exit outside cyclic exception handlers - #138189

Merged
steipete merged 2 commits into
mainfrom
codex/fix-ci-owner-cyclic-error
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-ci-owner-cyclic-error

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

On macOS Python 3.9.6, a cyclic exception context lets the Git checkout owner print its redacted diagnostic but hang when raising SystemExit inside the handler. The same problem affects terminal fetch-timeout and Git-failure exits. Python's implicit exception chaining traverses that cycle while attaching the new exit exception.

Why This Change Was Made

Choose the terminal exit code in the existing handlers, then raise it after the active exception has been cleared. Success stays 0, fetch timeout stays 124, Git failure keeps its own code, and ownership/setup failure stays 125. Diagnostic redaction, checkout fencing, cancellation, cleanup and retry policy are unchanged.

User Impact

Failed checkouts terminate promptly with the original diagnostic and documented exit status on the system Python shipped with affected macOS hosts.

Evidence

  • Actual unchanged owner under /usr/bin/python3 3.9.6: self-context PermissionError, FetchTimeout and GitFailure each exceeded the bounded process deadline. Successful and ordinary-failure controls returned their expected codes.
  • The same seven native process cases pass after the fix; cyclic failures terminate in 136–194 ms with the expected codes and redacted output.
  • All 72 tests in ci-platform-checkout.test.ts pass, including the existing cyclic-context regression, diagnostic redaction, ownership/cancellation and cleanup contracts.
  • Full changed checks and independent Codex review pass.

Dependency source was inspected directly: CPython 3.9.6 implicit exception chaining. No Python upgrade, timeout increase, or weakened assertion is required. Tooling delta: +6/-5, net +1 including the explanatory comment; tests unchanged.

@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 7:10 AM ET / 11:10 UTC.

ClawSweeper review

What this changes

This PR defers checkout-owner process termination until after Python exception handlers finish, then regenerates the embedded CI workflow copy.

Merge readiness

⛔ Blocked before merge - 1 item remains

No blocking findings. The regenerated workflow copy now matches the canonical checkout-owner action, and the post-handler exit preserves the existing classified statuses; this maintainer-owned PR should remain open for normal exact-head CI handling.

Priority: P2
Reviewed head: 215af28d25232b58b55bd9575242da84b6b0585e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, preserves terminal status behavior, and repairs the previously identified generated-projection mismatch.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a maintainer-authored CI reliability PR, so the external-contributor proof gate does not apply; the PR body nonetheless reports an after-fix native Python 3.9.6 process run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a maintainer-authored CI reliability PR, so the external-contributor proof gate does not apply; the PR body nonetheless reports an after-fix native Python 3.9.6 process run.
Evidence reviewed 7 items Canonical terminal boundary: The canonical owner records the classified status during handling and raises once after the handler, preserving success 0, timeout 124, GitFailure.code, and generic failure 125.
Generated workflow parity: The second PR commit changes only the embedded workflow projection, whose terminal block matches the canonical action.
Projection owner and guard: The generator derives the workflow heredoc from owner.py, and the workflow guard executes its check mode.
Findings None None.
Security None None.

How this fits together

The checkout-owner action runs Git checkout work and converts failures into diagnostic output and exit statuses. The CI workflow embeds a generated copy for its early checkout step.

flowchart LR
  A[Git checkout work] --> B[Checkout owner]
  B --> C[Classify failure]
  C --> D[Exit after handler]
  D --> E[CI job result]
Loading

Before merge

  • Resolve merge risk (P1) - Independent inspection of the CPython 3.9.6 implementation was unavailable because the review environment could not resolve GitHub; the supplied native-process evidence remains the only direct platform proof reviewed.
Agent review details

Security

None.

PR surface

Config +2. Total +2 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 2 12 10 +2
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 10 +2

Review metrics

Metric Value Why it matters
Production versus generated delta canonical production +6/-5 (net +1); generated workflow +6/-5 (net +1); tests 0 The one-line canonical growth documents the non-obvious exception-context invariant, while the generated CI copy mirrors it exactly.

Merge-risk options

Maintainer options:

  1. Retain the post-handler exit (recommended)
    Allow normal exact-head CI to validate the targeted Python-host checkout behavior while keeping the canonical and generated copies aligned.

Technical review

Best possible solution:

Keep the single post-handler terminal exit in the canonical owner and its generated workflow projection, with normal exact-head CI validating the affected host path.

Do we have a high-confidence way to reproduce the issue?

No: the PR supplies a macOS Python 3.9.6 native-process result, but its trace and the upstream CPython source were not independently accessible in this review environment. Source inspection does verify the changed owner boundary and existing cyclic-context subprocess coverage.

Is this the best way to solve the issue?

Yes: selecting the exit status inside the handlers and raising once after they clear is the narrowest repair; it preserves diagnostic, retry, and exit-status policy while the generator keeps the workflow copy synchronized.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 93d3f565a7a6.

Labels

Label justifications:

  • P2: This is a bounded repair to CI checkout termination on affected Python hosts.
  • merge-risk: 🚨 availability: The changed terminal boundary determines whether failed CI checkout work exits promptly with the intended status.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a maintainer-authored CI reliability PR, so the external-contributor proof gate does not apply; the PR body nonetheless reports an after-fix native Python 3.9.6 process run.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-04T10:36:06.316Z sha f00a092 :: blocked before merge. :: [P1] Regenerate the inlined CI owner

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The first CI run caught a missing generated projection: the canonical Python owner was fixed, but the embedded copy in ci.yml was stale. I ran scripts/generate-ci-git-owner.mts and committed the byte-identical generated output in 215af28d252.

The generator check reproduced the failure before regeneration and now passes. Both affected tooling suites pass: 523 tests, with 34 existing skips. Full changed-file checks pass, and independent review found no actionable P0–P2 defects. The generated change mirrors the reviewed exit handling exactly; it changes no workflow jobs or policy. Total delta is +1 line in the canonical tooling source and +1 generated line; production and test source are unchanged.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the Before merge dependency-inspection item: I personally read CPython 3.9.6 Python/errors.c lines 95–151. In _PyErr_SetObject, the context traversal at lines 132–141 stops on NULL or the newly raised exception; an existing self-cycle cannot reach either when SystemExit is raised inside that handler. Raising after the handler clears the active exception avoids the traversal.

Source: https://github.com/python/cpython/blob/v3.9.6/Python/errors.c#L95-L151

The actual unchanged checkout owner on /usr/bin/python3 3.9.6 exceeded a 3-second process deadline for cyclic PermissionError, FetchTimeout and GitFailure contexts. The candidate returned 125, 124 and 23 respectively in 140, 136 and 194 ms. Success and ordinary failures retained their statuses and redacted diagnostics. The complete checkout/workflow suites pass (523 tests); canonical generator check, changed-file gates and independent review pass. The generated workflow copy is included in this head.

The first CI run also hit an unrelated service-child lifecycle observation deadline. Its unchanged 24-test native suite passes; the exact failed CI job is being rerun, and landing remains contingent on green checks.

@steipete
steipete force-pushed the codex/fix-ci-owner-cyclic-error branch from 215af28 to edf0318 Compare September 4, 2026 12:17
@steipete
steipete merged commit d0f0612 into main Sep 4, 2026
143 checks passed
@steipete
steipete deleted the codex/fix-ci-owner-cyclic-error branch September 4, 2026 12:36
steipete added a commit that referenced this pull request Sep 4, 2026
Reduce unrelated host-process enumeration during owned Git cleanup while preserving zombie handling, native observation failures, cancellation, and terminal fencing. Keep the initial absent-group fast path and validate native group/session selection with real-process regression coverage.

Controlled native Mac proof reduced system CPU by about 23% with only a modest wall-time change. Current-base owner/platform tests pass without altered watchdogs or assertions. Related: #138034, #138189.
steipete added a commit that referenced this pull request Sep 4, 2026
Reduce unrelated host-process enumeration during owned Git cleanup while preserving zombie handling, native observation failures, cancellation, and terminal fencing. Keep the initial absent-group fast path and validate native group/session selection with real-process regression coverage.

Controlled native Mac proof reduced system CPU by about 23% with only a modest wall-time change. Current-base owner/platform tests pass without altered watchdogs or assertions. Related: #138034, #138189.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
* fix(ci): exit outside cyclic exception handlers

* fix(ci): regenerate the cyclic-error-safe Git owner
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
Reduce unrelated host-process enumeration during owned Git cleanup while preserving zombie handling, native observation failures, cancellation, and terminal fencing. Keep the initial absent-group fast path and validate native group/session selection with real-process regression coverage.

Controlled native Mac proof reduced system CPU by about 23% with only a modest wall-time change. Current-base owner/platform tests pass without altered watchdogs or assertions. Related: openclaw#138034, openclaw#138189.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant