Skip to content

fix(assistant): inline conversation history into the Claude prompt#18

Merged
sbeashwar merged 1 commit into
mainfrom
fix/chat-history-context
May 3, 2026
Merged

fix(assistant): inline conversation history into the Claude prompt#18
sbeashwar merged 1 commit into
mainfrom
fix/chat-history-context

Conversation

@sbeashwar

Copy link
Copy Markdown
Owner

Summary

  • After PR feat(assistant): replace GitHub Models with claude -p — full workspace parity #17 the PWA chat relied on `claude -p --session-id ` to carry context across turns. That broke for: pre-cutover conversations (no on-disk session for that UUID), close-together turns (Claude rejected the second with "Session ID is already in use"), and proactive messages injected via `/api/assistant/fire` (Claude never saw them).
  • Fix: always pull prior turns from our DB and inline them into the user prompt (last 30 turns, capped). Drop `--session-id` entirely. Cheap, deterministic, surface-independent.

Test plan

  • Build clean, 45/45 tests pass
  • Live smoke against the failed conversation `44d31f64-…`: "Try again — what was my original question in this thread?" → Claude correctly recalled "List out my confirmed travel plans until August" and offered to answer it from `notes/travel/`

🤖 Generated with Claude Code

After PR #17 the PWA chat relied on `claude -p --session-id <conv-id>`
to carry conversation context across turns. That broke for:
  1) conversations that pre-dated the claude-cli backend (no on-disk
     Claude session existed for that UUID),
  2) cases where two turns fired close together — Claude rejected the
     second with "Session ID is already in use",
  3) proactive messages injected via /api/assistant/fire (Claude never
     saw them).

Fix: always pull prior turns from our DB and inline them into the user
prompt (last 30 turns, capped). Drop --session-id entirely so each
spawn is a fresh session. Cheap, deterministic, surface-independent —
any conversation, any backend, any restart, any proactive injection,
Claude has full context.

Verified: replied to a pre-cutover conversation with "what was my
original question?" — Claude correctly recalled "List out my confirmed
travel plans until August" and offered to answer it from
notes/travel/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sbeashwar sbeashwar merged commit 0805325 into main May 3, 2026
1 check passed
@sbeashwar sbeashwar deleted the fix/chat-history-context branch May 3, 2026 02:52
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.

1 participant