Skip to content

fix(process): join owned groups through transient EPERM - #158483

Merged
steipete merged 1 commit into
mainfrom
tcr/land-p003-1790373687
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
tcr/land-p003-1790373687

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

iOS signing commands can report kill EPERM instead of their original timeout or output-limit failure while Darwin is reaping an owned process group.

User Impact

Cleanup waits for confirmed process-group disappearance and preserves the original command failure after transient permission errors. Persistent permission errors and later hard signaling errors still fail. No configuration or migration is required.

Why This Change Was Made

Treat EPERM as indeterminate, retire group ownership only after ESRCH, and keep post-close escalation in the bounded drain. The regression fixtures use real owned child processes. Triage fixtures wait for their actual branch-spawn receipt after maintenance and cancel/join that waiter before cleanup.

This replays campaign batch p003. Main's newer triage cleanup from #155736 and Node subprocess test structure from #146807 are preserved. No changed path matches the current CODEOWNERS file.

Evidence

  • Historical failing-before proof: all four native regressions failed against the original owner (transient EPERM, persistent EPERM, natural exit before signaling, and EPERM masking a later EIO); all four passed with the repair.
  • Blacksmith Testbox verified commit 6524a5a14b9bb4001c24cef060aa4a678c48ccc0, tree d4b8f26ffe7ee368ee96108c28b15eb2ac35a1ab. CI=1 pnpm test src/infra/update-managed-service-triage.test.ts test/scripts/mobile-release-authority.test.ts --maxWorkers=1 passed: 138 tests across both complete files. Testbox backing run. The wrapper returned exit 0 and stopped its lease; the backing Actions run may show cancelled because the external lease owns execution and cleanup.
  • Measured file durations: mobile release authority 77.53s, triage 51.29s. These existing native suites exercise release authorization and process/service ownership that require subprocess boundaries. The four added regressions took approximately 2.10s combined; persistent EPERM covers the existing two-second bounded join contract.
  • Targeted oxfmt and git diff --check passed. Independent Codex review found no actionable P0-P2 findings.
  • OPENCLAW_TESTBOX=1 node scripts/check-changed.mjs -- <five changed paths> completed all selected typechecks, ratchets, formatting, guards, and dead-export scans. The overall command exits 1 solely because core lint reports 1,025 lines against a 1,000-line cap in unchanged src/agents/embedded-agent-runner/run/attempt-session-replay.test.ts. Changed-check run.
  • A separate Testbox reproduced that exact sole lint error from main revision a044077163354e127562db74bbdf5f618b9745d6 using its unchanged file and lint configuration. The remaining pnpm lint:scripts and changed root-test type-aware lint both passed with zero warnings/errors. Baseline and remaining-lint run. No assertion, timeout, skip, or baseline was weakened.

Production/tooling: +37/-12 lines. Tests/support: +438/-5 lines.

Treat Darwin EPERM as an indeterminate process-group state while preserving
hard signaling errors. Require ESRCH before retiring ownership, cancel the
grace timer on child close, and keep post-close escalation in the bounded
group drain.

Synchronize triage fixtures on the real branch-spawn receipt after maintenance
finishes. Keep the existing descendant assertions and readiness budget, and
abort and join the receipt waiter before cleanup releases fixture state.

Cover transient and persistent EPERM, natural exit before signaling, and a
later hard signaling failure using real owned child processes. All four
regressions fail on the original owner and pass with this repair.

Validation includes failing-before native regressions, repeated process-tree
and triage cases, full test files, typechecks, changed-file type-aware lint,
script lint, and independent review. Full changed checks remain blocked by
pre-existing Telegram test-support unused exports. Full core lint timed out
at its unchanged 900-second limit on both attempts.
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 8:31 PM ET / September 26, 2026, 00:31 UTC.

ClawSweeper review

What this changes

The branch changes iOS signing command cleanup to wait through transient process-group permission errors and adds native process and updater-triage regression coverage.

Merge readiness

✅ Ready for maintainer review

Current main and the latest release retain the reported EPERM failure path. The proposed repair is focused, has relevant native process proof, and has no confirmed blocking defect.

Priority: P2
Reviewed head: 6524a5a14b9bb4001c24cef060aa4a678c48ccc0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused process-owner repair has relevant native boundary proof and no confirmed correctness or security finding.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.
Evidence reviewed 8 items Current-main defect: The current-main signing action treats a non-ESRCH process-group probe error as a thrown error, so EPERM can replace the original timeout or output-limit result.
Introduced repair: The introduced patch treats EPERM as indeterminate, waits for ESRCH before retiring group ownership, and preserves hard signaling errors.
Production-path regression coverage: Four cases call the production bounded-command runner with real child processes and inject transient EPERM, persistent EPERM, exit-before-signal, and later hard-error conditions.
Findings None None.
Security None None.

How this fits together

The iOS release workflow uses a job-owned keychain action to run signing commands. That action must stop its child process group and report the command's result; native fixtures check its teardown and related updater-triage cleanup.

flowchart LR
A[iOS release workflow] --> B[Signing keychain action]
B --> C[Bounded command runner]
C --> D[Owned process group]
D --> E[Group exit check]
E --> F[Command result or cleanup error]
G[Native regression fixtures] --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +433, Config +25. Total +458 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 438 5 +433
Docs 0 0 0 0
Config 1 37 12 +25
Generated 0 0 0 0
Other 0 0 0 0
Total 5 475 17 +458

Review metrics

Metric Value Why it matters
Production versus test growth production/tooling +37/-12; tests/support +438/-5 Most added lines are native fault fixtures; the production growth implements explicit process-group exit and error handling.
Added native regression cost 4 cases, approximately 2.10 seconds combined The PR separates the new subprocess-boundary cost from its existing, longer native suites.

Technical review

Best possible solution:

Keep process-group ownership bounded, confirm disappearance before reporting the original command failure, and retain native regression coverage at the signing action.

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

Yes. Current-main source shows where an EPERM group probe escapes, and the proposed native fixture provides a focused real-child fault-injection path; this reviewer did not execute it.

Is this the best way to solve the issue?

Yes. The repair stays in the signing action that owns subprocess termination and preserves the original failure only after group exit is confirmed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9665d17902cf.

Labels

Label changes:

  • add P2: Transient process-group permission errors can obscure iOS signing command failures, but the affected workflow is limited to release automation.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.

Label justifications:

  • P2: Transient process-group permission errors can obscure iOS signing command failures, but the affected workflow is limited to release automation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records failing-before and passing-after results for four injected EPERM and hard-error cases through the production signing command runner with real Node child processes, plus 138 passing tests at the proposed commit. The linked Testbox log could not be independently fetched in this sandbox; no stored-data contract changes.

Evidence

What I checked:

  • Current-main defect: The current-main signing action treats a non-ESRCH process-group probe error as a thrown error, so EPERM can replace the original timeout or output-limit result. (.github/actions/ios-signing-keychain/keychain.mjs:152, 9665d17902cf)
  • Introduced repair: The introduced patch treats EPERM as indeterminate, waits for ESRCH before retiring group ownership, and preserves hard signaling errors. (.github/actions/ios-signing-keychain/keychain.mjs:162, 6524a5a14b9b)
  • Production-path regression coverage: Four cases call the production bounded-command runner with real child processes and inject transient EPERM, persistent EPERM, exit-before-signal, and later hard-error conditions. (test/scripts/mobile-release-process.test-support.ts:288, 6524a5a14b9b)
  • Contributor's before-and-after proof: The reviewed PR body reports four failing-before native regressions that passed after the repair and 138 passing tests across the two complete test files on a Testbox at the exact proposed commit. The linked Actions run is a cancelled lease wrapper; its log archive was unavailable through this sandbox, so its assertions were not independently inspected.
  • Release workflow boundary: The iOS beta release workflow checks out trusted release authority and invokes the signing keychain action before signing proof. (.github/workflows/ios-beta-release.yml:240, 6524a5a14b9b)
  • Latest-release check: The published v2026.9.6 action still uses the earlier process-group probe and has no provisional EPERM handling; the proposed behavior is absent from that release. (.github/actions/ios-signing-keychain/keychain.mjs:152, eb377ac59e6c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • 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.

@steipete
steipete merged commit 478ac90 into main Sep 26, 2026
120 checks passed
@steipete
steipete deleted the tcr/land-p003-1790373687 branch September 26, 2026 01:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
)

Treat Darwin EPERM as an indeterminate process-group state while preserving
hard signaling errors. Require ESRCH before retiring ownership, cancel the
grace timer on child close, and keep post-close escalation in the bounded
group drain.

Synchronize triage fixtures on the real branch-spawn receipt after maintenance
finishes. Keep the existing descendant assertions and readiness budget, and
abort and join the receipt waiter before cleanup releases fixture state.

Cover transient and persistent EPERM, natural exit before signaling, and a
later hard signaling failure using real owned child processes. All four
regressions fail on the original owner and pass with this repair.

Validation includes failing-before native regressions, repeated process-tree
and triage cases, full test files, typechecks, changed-file type-aware lint,
script lint, and independent review. Full changed checks remain blocked by
pre-existing Telegram test-support unused exports. Full core lint timed out
at its unchanged 900-second limit on both attempts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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