Skip to content

fix(opencode-plugin): report an unreachable server in the session - #7647

Open
marlon-costa-dc wants to merge 1 commit into
volcengine:mainfrom
marlon-costa-dc:fix/opencode-surface-memory-outage
Open

marlon-costa-dc wants to merge 1 commit into
volcengine:mainfrom
marlon-costa-dc:fix/opencode-surface-memory-outage

Conversation

@marlon-costa-dc

Copy link
Copy Markdown

Description

When the OpenViking server is unreachable, the OpenCode plugin shows nothing in the session. The only outage signal is the startup health toast in initializeRuntime, which fires before the OpenCode TUI attaches, so it is dropped. Every later prompt then reaches if (!health.ok) return in buildRelevantMemories and runs without recalled memories, while the user sees no sign of it. The warning goes only to the plugin log file.

With this change, a failed per-prompt health check logs the cause and posts an error toast naming the endpoint and the error, so the session shows that the prompt runs without memory.

Human Involvement

  • A human participated in the implementation or review loop

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • createMemoryRecall takes an optional notify(message, variant); when absent it is a no-op, so existing callers keep the old behaviour.
  • On a failed /health, recall logs WARN recall with endpoint, status and error, and calls notify with an error variant.
  • createOpenVikingRuntime passes makeToast(client) as the notifier.
  • New test: a real refused connection on 127.0.0.1:1 (no mock) produces exactly one error notice and no recall block.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (node --test tests/*.test.mjs: 62 pass; npm run check clean)
  • I have tested this on the following platforms:
    • Linux

Also verified in a live OpenCode 1.19.5 TUI with the server stopped: the toast OpenViking memory is unavailable at http://127.0.0.1:… appears on the first prompt. Before the change, nothing was shown.

Checklist

  • My code follows the project's coding style

🤖 Generated with Claude Code

The only outage signal was the startup health toast, which fires before the
OpenCode TUI attaches and is dropped. Every later prompt then hit
`if (!health.ok) return` and ran without recalled memories while the user saw
nothing; the warning reached only the plugin log.

When the per-prompt health check fails, recall now logs the cause and posts an
error toast naming the endpoint and the error, so the session shows that the
prompt runs without memory. createMemoryRecall takes the notifier from the
runtime (makeToast(client)); callers without one keep the old behaviour.

Verified in a live OpenCode 1.19.5 TUI with the server stopped: the toast
appears on the first prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant