Skip to content

feat: remember stopOnExit:false processes so skip and restart apply across OpenCode restarts - #2

Merged
PixelWinner merged 1 commit into
mainfrom
feat/durable-registry
Sep 7, 2026
Merged

feat: remember stopOnExit:false processes so skip and restart apply across OpenCode restarts#2
PixelWinner merged 1 commit into
mainfrom
feat/durable-registry

Conversation

@PixelWinner

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings September 7, 2026 09:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new runQuery output cap is implemented using string length rather than bytes, which can exceed the intended resource limit and should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces a “durable” subsystem that records stopOnExit: false processes to disk so subsequent OpenCode restarts can re-adopt (or restart) those processes instead of launching duplicates, and bumps the package to 1.2.0 with updated release/docs/tests to match.

Changes:

  • Add durable registry + lock + per-platform process identity probing to enable cross-restart process re-adoption.
  • Wire durable dependencies into the server/runtime and extend logging with durable-related events/causes.
  • Update packaging, versioned documentation, and tests (including integration coverage) for the new behavior and the 1.2.0 release.
File summaries
File Description
tests/workflows.test.ts Asserts durable tests don’t narrow the existing workflow matrix/suite.
tests/server.test.ts Adds coverage for durable wiring, hashing, and dependency gating.
tests/release-package.test.ts Updates release manifest expectations and packaged file list.
tests/release-draft.test.ts Updates release environment/tag expectations for 1.2.0.
tests/readme.test.ts Enforces new README section/content for durable behavior and migration.
tests/process-identity.test.ts New unit tests for process identity tokens/probing across OSes.
tests/manifest.test.ts Updates manifest expectations (version/homepage).
tests/logger.test.ts Adds durable event formatting + durable-unavailable skip coverage.
tests/helpers/core-fixtures.ts New shared fixtures (registry/identity/process fakes) for core tests.
tests/fixtures/durable-child.mjs New long-lived child fixture for durable integration tests.
tests/durable-registry.test.ts New tests for registry root resolution, validation, and locking.
tests/durable-integration.test.ts New integration tests covering re-adoption/restart with real OS processes.
tests/core.test.ts Refactors to use shared fixtures.
tests/community-files.test.ts Updates bug template placeholder version.
src/server.ts Instantiates identity + durable registry and passes them into server deps.
src/server-internal.ts Builds/threads durable run options (owner identity + project hash) into core.
src/process-tree.ts Switches error-code extraction to shared helper.
src/process-identity.ts New per-platform process identity + probe controller implementation.
src/logger.ts Adds durable event types and formatting.
src/error-code.ts New shared getErrorCode helper.
src/durable-registry.ts New durable registry (read/write/quarantine + hashing + state root).
src/durable-lock.ts New cross-process lock with guarded reclaim logic.
scripts/release-package.mjs Updates package version and required release paths.
README.md Documents cross-restart durability, registry storage, and upgrade steps.
package.json Bumps version/homepage to 1.2.0.
.gitignore Ignores local agent workspace directories.
.github/ISSUE_TEMPLATE/bug_report.yml Updates plugin version placeholder to 1.2.0.
dist/server.js.map Rebuilt artifact for server changes.
dist/server.js Rebuilt artifact for server changes.
dist/server.d.ts.map Rebuilt artifact for server type changes.
dist/server-internal.js.map Rebuilt artifact for server-internal changes.
dist/server-internal.js Rebuilt artifact for server-internal changes.
dist/server-internal.d.ts.map Rebuilt artifact for server-internal type changes.
dist/server-internal.d.ts Rebuilt artifact for server-internal type changes.
dist/process-tree.js Rebuilt artifact for process-tree changes.
dist/process-tree.d.ts.map Rebuilt artifact for process-tree type changes.
dist/process-identity.js.map New built artifact for process identity.
dist/process-identity.js New built artifact for process identity.
dist/process-identity.d.ts.map New built artifact for process identity types.
dist/process-identity.d.ts New built artifact for process identity types.
dist/logger.js Rebuilt artifact for logger changes.
dist/logger.d.ts.map Rebuilt artifact for logger type changes.
dist/logger.d.ts Rebuilt artifact for logger type changes.
dist/error-code.js.map New built artifact for error-code helper.
dist/error-code.js New built artifact for error-code helper.
dist/error-code.d.ts.map New built artifact for error-code helper types.
dist/error-code.d.ts New built artifact for error-code helper types.
dist/durable-registry.js.map New built artifact for durable registry.
dist/durable-registry.js New built artifact for durable registry.
dist/durable-registry.d.ts.map New built artifact for durable registry types.
dist/durable-registry.d.ts New built artifact for durable registry types.
dist/durable-lock.js.map New built artifact for durable lock.
dist/durable-lock.js New built artifact for durable lock.
dist/durable-lock.d.ts.map New built artifact for durable lock types.
dist/durable-lock.d.ts New built artifact for durable lock types.
dist/core.d.ts.map Rebuilt artifact for core type changes (durable options/types).
dist/core.d.ts Rebuilt artifact for core type changes (durable options/types).
Review details
  • Files reviewed: 29/64 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/process-identity.ts
Comment on lines +168 to +190
let settled = false;
let output = "";
let timer: ReturnType<typeof setTimeout> | undefined;

const settle = (outcome: QueryOutcome): void => {
if (settled) {
return;
}
settled = true;
if (timer !== undefined) {
clearTimeout(timer);
}
resolve(outcome);
};

try {
child.stdout?.on("data", (chunk) => {
if (output.length < MAX_QUERY_OUTPUT_BYTES) {
const text =
typeof chunk === "string" ? chunk : chunk.toString("utf8");
output += text.slice(0, MAX_QUERY_OUTPUT_BYTES - output.length);
}
});
@PixelWinner
PixelWinner merged commit 97d1d1a into main Sep 7, 2026
5 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.

2 participants