Skip to content

fix: resilient worker prompting with agent-not-found retry#67

Merged
BYK merged 1 commit intomainfrom
fix/agent-not-found-retry
Apr 14, 2026
Merged

fix: resilient worker prompting with agent-not-found retry#67
BYK merged 1 commit intomainfrom
fix/agent-not-found-retry

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented Apr 14, 2026

Summary

Fixes #64 — occasional Agent not found: "lore-distill" and SyntaxError: JSON Parse error: Unexpected EOF errors.

  • New src/worker.ts: Shared promptWorker() helper that uses the session.prompt() return value directly (eliminates redundant session.messages() round-trip), catches SDK-level errors, and retries without the agent parameter when OpenCode loses plugin agent registrations after a config re-read.
  • Defensive JSON parsing: parseSourceIds() in distillation.ts wraps JSON.parse(r.source_ids) to handle corrupt DB data gracefully.
  • 17 new tests covering success, agent-not-found retry, SDK throws, session rotation, and parseSourceIds edge cases.

Add promptWorker() helper in src/worker.ts that uses the session.prompt()
return value directly (eliminating redundant session.messages() calls) and
retries without the agent parameter when OpenCode loses plugin agent
registrations. Also adds defensive JSON.parse for source_ids in distillation
DB reads.

Closes #64
@BYK BYK enabled auto-merge (squash) April 14, 2026 14:14
@BYK BYK mentioned this pull request Apr 14, 2026
@BYK BYK merged commit 8473dae into main Apr 14, 2026
1 check passed
@BYK BYK deleted the fix/agent-not-found-retry branch April 14, 2026 14:15
@craft-deployer craft-deployer bot mentioned this pull request Apr 14, 2026
2 tasks
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.

Ocassional Json parse error

1 participant