feat: ai-chat reference project + MCP agent-chat tooling (5/5)#3546
feat: ai-chat reference project + MCP agent-chat tooling (5/5)#3546ericallam wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 5baac29 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| }, | ||
| }); | ||
| session.runId = result.id; | ||
| session.lastEventId = undefined; |
There was a problem hiding this comment.
🔴 Resetting lastEventId to undefined on upgrade causes SSE replay of entire session history
In collectAgentResponse, when a trigger:upgrade-required chunk is received, session.lastEventId is set to undefined (line 390) before recursively calling collectAgentResponse. The recursive call creates a new SSEStreamSubscription using session.lastEventId (now undefined) as the lastEventId option (agentChat.ts:338), which means the new subscription replays the entire session .out stream from the very beginning.
Since session .out is a durable stream containing all historical chunks across runs, the replayed events will include old turns' trigger:turn-complete chunks. The first historical trigger:turn-complete hit (line 366-368) immediately breaks the collection loop, causing the function to return with empty/partial text from a previous turn instead of the new run's response.
Expected fix
Keep session.lastEventId as-is (pointing to the trigger:upgrade-required chunk's SSE id) so the recursive subscription resumes right after the upgrade marker, where the new run's output will appear.
| session.lastEventId = undefined; | |
| reader.releaseLock(); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| packageVersion: buildManifest.packageVersion, | ||
| cliPackageVersion: buildManifest.cliPackageVersion, | ||
| tasks: workerManifest.tasks, | ||
| prompts: workerManifest.prompts, |
There was a problem hiding this comment.
🚩 managed-index-controller adds prompts but not skills to worker registration payload
Both dev-index-worker.ts:187 and managed-index-worker.ts:183 now emit skills: resourceCatalog.listSkillManifests() in their worker manifests. The managed-index-controller.ts forwards tasks, prompts (newly added at line 107), and queues to the server — but does NOT forward skills. If skills need to be registered server-side (for dashboard display, deploy metadata, etc.), this omission would silently drop them in the managed (production) indexing path. Could be intentional if skills are only used at runtime and don't need server-side registration, but it's asymmetric with the prompts addition in the same PR.
Was this helpful? React with 👍 or 👎 to provide feedback.
Top of the chat.agent stack: a full Next.js reference project that exercises chat.agent end-to-end, plus the CLI MCP tools that drive agent runs from Claude Code / Cursor / etc. references/ai-chat: - Full Next.js app with prisma persistence, multi-chat sidebar, per-chat model picker, debug panel, tool examples, smoke tests - Reference tools: getCurrentTime, searchHackerNews, createGithubIssue, PR review helpers, code sandbox - chat-client-test orchestrator for concurrent-send stress - references/hello-world chatAgent + triggerAndSubscribe examples CLI MCP tooling for chat.agent: - mcp/tools/agentChat.ts (start_agent_chat, send_agent_message, close_agent_chat) - mcp/tools/agents.ts + tasks.ts (list agents, agent run details) - dev-run-controller OOM kill + taskRunProcessPool tweaks - dev/managed entry-point hooks for skills bundling - buildWorker + bundleSkills (agent skills support) Includes ai-tool-helpers + mcp-agent-chat-sessions changesets, plus the streamdown@2 patch and pnpm-lock reconciliation. (Will be renamed to feature/ai-chat-reference-and-cli before push.)
ecfac76 to
7ee523e
Compare
882544c to
5baac29
Compare
Layer 5 of 5 in the chat.agent stack split
Top of the chat.agent stack: a full Next.js reference project that
exercises chat.agent end-to-end, plus the CLI MCP tools that drive
agent runs from Claude Code / Cursor / etc.
Targets
feature/agent-view-dashboard— merge lastreferences/ai-chat
per-chat model picker, debug panel, tool examples, smoke tests
getCurrentTime,searchHackerNews,createGithubIssue, PR review helpers, code sandboxchat-client-testorchestrator for concurrent-send stressreferences/hello-worldchatAgent+triggerAndSubscribeexamplesCLI MCP tooling for chat.agent
mcp/tools/agentChat.ts(start_agent_chat,send_agent_message,close_agent_chat)mcp/tools/agents.ts+tasks.ts(list agents, agent run details)dev-run-controllerOOM kill +taskRunProcessPooltweaksbuildWorker+bundleSkills(agent skills support)Includes
ai-tool-helpers+mcp-agent-chat-sessionschangesets, plusthe
streamdown@2patch andpnpm-lockreconciliation.Stack