Skip to content

fix: resolve five code-review bugs (store fan-out, config, llm streaming) - #490

Draft
TYRMars wants to merge 1 commit into
mainfrom
claude/vibrant-dijkstra-2s4kak
Draft

fix: resolve five code-review bugs (store fan-out, config, llm streaming)#490
TYRMars wants to merge 1 commit into
mainfrom
claude/vibrant-dijkstra-2s4kak

Conversation

@TYRMars

@TYRMars TYRMars commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves a batch of open code-review issues whose fixes are self-contained and reference code that exists on main.

Issue Area Fix
#340 storeFanout.emit (event-source) Wrap each subscriber in try/catch so a throwing listener neither rejects the already-committed requirement/run/todo/learning-memory write nor starves later listeners.
#454 storeListeners.emit (activity/comment/label JSON-file + in-memory backends) Same per-listener isolation, matching the existing doc-store precedent. (Completes #340's coverage for the three private-Listeners copies.)
#457 jarvis-appconfig.loadConfig A non-positive/unparseable JARVIS_MEMORY_TOKENS (0, negatives, non-numeric) now disables memory instead of installing a ~zero-budget window that compacts every request down to the most-recent turn — mirroring the CLI composition root.
#475 llmopenai.ts StreamAccumulator.#finalise Synthesise a tool-call id (call_<index>) when an OpenAI-compatible stream (Kimi/Ollama) omits one, so the call isn't silently dropped while finish_reason stays tool_calls and the turn ends with an empty assistant message.
#476 llmresponses.ts completeStream For api-key auth, a 401 now falls through to the !resp.ok branch so the real status + upstream error body surface verbatim (and the response body is consumed) instead of a fixed "cannot refresh" string.

Changes

  • packages/store/src/event-source.tsFanout.emit per-listener try/catch (+ docstring).
  • packages/store/src/{activity,comment,label}-store.tsListeners.emit per-listener try/catch.
  • packages/jarvis-app/src/config.ts — positive-guard memoryTokens.
  • packages/llm/src/openai.ts — synthesise missing tool-call id from the slot index.
  • packages/llm/src/responses.ts — restrict the 401 refresh path to OAuth auth.

Testing

  • New regression tests for each fix, exercised across all affected store backends (JSON-file, in-memory, and sqlite via the shared contract).
  • Updated the responses test that asserted the old api-key 401 behaviour.
  • pnpm -r typecheck, pnpm lint (0 errors), and the @jarvis/llm / @jarvis/store / @jarvis/jarvis-app suites all pass (157 / 454 / 20 tests).

Not addressed here

Issues #483#485 target an uncommitted packages/ddns feature (and an http.ts SSRF guard) that does not exist on main, so they can't be resolved against the current tree. #468 (making the memory.* family opt-in behind JARVIS_ENABLE_MEMORY) is a behaviour change with design trade-offs and was left for a maintainer decision.

🤖 Generated with Claude Code


Generated by Claude Code

…ing)

Resolves a batch of open code-review issues that reference existing code:

- #340 / #454: isolate each subscriber in `Fanout.emit` (event-source, powers
  the sqlite requirement/run/todo/learning-memory stores) and in the private
  `Listeners.emit` of the JSON-file/in-memory activity/comment/label stores, so
  a throwing listener neither rejects the already-committed write nor starves
  later listeners — matching the doc-store precedent.
- #457: treat a non-positive/unparseable JARVIS_MEMORY_TOKENS as "disable
  memory" instead of installing a ~zero-budget window that strips history every
  turn, mirroring the CLI composition root.
- #475: synthesise a tool-call id (call_<index>) when an OpenAI-compatible
  stream (Kimi/Ollama) omits one, so the call isn't dropped while finish_reason
  stays "tool_calls" and the turn ends with an empty assistant message.
- #476: for api-key auth on the Responses provider, let a 401 fall through to
  the !resp.ok branch so the real status and upstream error body surface
  verbatim (and the body is consumed) instead of a fixed "cannot refresh".

Adds regression tests across all affected backends and updates the responses
test that asserted the old api-key 401 behaviour.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvAr6jY3196yLUJmErV1kK
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