Skip to content

Prevent idle owner eviction from stranding bot work and publication - #6

Merged
d3cker merged 2 commits into
mainfrom
codex/owner-lifecycle-recovery
Sep 13, 2026
Merged

Prevent idle owner eviction from stranding bot work and publication#6
d3cker merged 2 commits into
mainfrom
codex/owner-lifecycle-recovery

Conversation

@d3cker

@d3cker d3cker commented Sep 13, 2026

Copy link
Copy Markdown
Owner

A bot can finish implementation in its worktree after OpenCode has evicted the idle primary checkout. The dispatcher then disappears, owner reactivation can fail with a held lock, and worker hooks fail with unavailable automation RPC instead of allowing publication or subsequent messages.

Refresh each scheduler/dispatcher owner every 30 seconds through the public plugin-list API, only after verifying that the discovered service PID matches the current process. Heartbeat requests have a deadline, do not overlap, stop on cleanup, and retry transient failures. Standalone instances skip a different or missing background service.

Make scheduler/dispatcher cleanup settle work and attempt every disposal step, including bridge removal and lock release, even when an evicted SDK registration rejects disposal. No active locks are forcibly removed and no failed session is automatically treated as successful. Update operational and runtime documentation.

Validation:

  • npm run check: lint, typecheck, 120 tests, and build passed.
  • npm run package:check: packaged installation passed.
  • Six new lifecycle regression tests cover cleanup failures with real lock reacquisition, service PID isolation, overlapping requests, cancellation, and transient retries.
  • Deployed the compiled hotfix on the affected OpenCode background service. The owner stayed active for over seven minutes without the prior idle eviction; explicit owner eviction followed by reactivation also succeeded without a lock error.
  • The original failed worktree session accepted a recovery acknowledgement and finished successfully after repair. Its source changes were separately backed up, verified, pushed, and recovered into a draft PR without rerunning implementation.

Release: package.json and package-lock.json are bumped to 0.6.2. Tag v0.6.2 points to the version commit and triggers the existing release workflow. The 0.6.2 package installation check also passed locally.

@d3cker
d3cker merged commit 59b22ff into main Sep 13, 2026
4 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.

1 participant