Skip to content

fix(cli): expose durable event persistence - #42840

Closed
kommander wants to merge 4 commits into
anomalyco:v2from
kommander:persist-server-events
Closed

kommander wants to merge 4 commits into
anomalyco:v2from
kommander:persist-server-events

Conversation

@kommander

@kommander kommander commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #42839

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Maps OPENCODE_EVENTS_PERSIST=1 to the existing ServerOptions.events.persist setting. The existing compiled-service smoke enables it and verifies historical session.created replay through the public client.

Also omits executablePath when no alternate Bun release is requested, preserving Bun's default compiler behavior and allowing the existing smoke check to run on the repository's pinned Bun version.

How did you verify your code works?

  • bun run script/build.ts --single --skip-install && bun run script/service-smoke.ts in packages/cli
  • bun typecheck in packages/cli
  • bun typecheck && bun validate && bun run build in packages/www
  • Full workspace typecheck from the pre-push hook

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference; please use your judgment.

  • packages/cli/script/service-smoke.ts:39-42 — the assertion reads the durable log exactly once, immediately after client.session.create({}) returns. If event persistence isn't synchronous with the create response, session.created may not be queryable yet and the smoke test flakes intermittently. Suggestion: wrap the for await + .some() check in a short retry/poll (e.g. up to ~2s) before failing.
  • packages/cli/script/service-smoke.ts:40-41 — const log = [] infers any[], and the whole log is buffered just to look for one event type. Since follow: false bounds it this is fine for a smoke script, but typing the array (or checking inside the for await and breaking early) would avoid the any leak.
  • packages/cli/script/build.ts:120 — ...(executablePath ? { executablePath } : {}) silently changes behavior whenever the path is unset rather than asserting it. If empty executablePath was what broke the binary smoke run, a comment saying so would help future readers connect it to the events-persist verification added here; otherwise consider splitting it into its own PR.
  • packages/cli/src/server-process.ts:93 + docs — opt-in via OPENCODE_EVENTS_PERSIST, default off, documented with the "no backfill / restart required" caveat in packages/www/content/docs/troubleshooting.mdx:127. Good defaults and honest docs.

No blocking issues found.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants