feat: ai-chat reference project + MCP agent-chat tooling (4/4)#3546
Conversation
🦋 Changeset detectedLatest commit: 8673d42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (56)
📒 Files selected for processing (19)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (13)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
🧰 Additional context used🪛 LanguageTool.claude/review-guides/chat-agent-sessions-row-agnostic.md[grammar] ~26-~26: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) [grammar] ~97-~97: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) [style] ~140-~140: To elevate your writing, try using an alternative expression here. (MATTERS_RELEVANT) [grammar] ~156-~156: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) [grammar] ~182-~182: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) [grammar] ~197-~197: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) 🔇 Additional comments (1)
WalkthroughThis PR adds comprehensive session-stream infrastructure, skill bundling, and MCP agent tooling. It documents the session migration strategy via changesets and a row-agnostic review guide; implements skill discovery and bundling (reading SKILL.md frontmatter, copying directories into Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
ecfac76 to
7ee523e
Compare
882544c to
5baac29
Compare
7ee523e to
fdc61c6
Compare
5baac29 to
e16efbb
Compare
fdc61c6 to
96700b1
Compare
e16efbb to
f4a7923
Compare
96700b1 to
482d752
Compare
f4a7923 to
04b98af
Compare
482d752 to
920e876
Compare
04b98af to
417344a
Compare
920e876 to
d96e2f7
Compare
417344a to
43fde3f
Compare
d96e2f7 to
3256f42
Compare
43fde3f to
c27cef9
Compare
3256f42 to
220b33c
Compare
c27cef9 to
48f030a
Compare
220b33c to
067109f
Compare
48f030a to
3c71eeb
Compare
067109f to
c1f6db7
Compare
3c71eeb to
866b175
Compare
c1f6db7 to
f75bcd8
Compare
866b175 to
2d9bcdb
Compare
f75bcd8 to
40a3dff
Compare
2d9bcdb to
d9fa1be
Compare
40a3dff to
1748445
Compare
d9fa1be to
b7ed332
Compare
f5e3067 to
6a1e9af
Compare
fef74f4 to
343c204
Compare
6a1e9af to
04e1747
Compare
343c204 to
480c5ea
Compare
04e1747 to
2a7d030
Compare
8954526 to
289ab08
Compare
…3542) ## Summary A `/sessions` dashboard for inspecting durable Sessions, an `AGENT` / `SCHEDULED` task-kind filter for the runs list, and the server-side hardening (rate-limit exemption for packets, retry-with-backoff on stream appends, typed too-large-chunk error) that the `chat.agent` runtime in #3543 needs. Builds on the Sessions primitive shipped in #3417. ## Design The Sessions list + detail routes mirror the run inspector pattern. `TaskTriggerSource` gains `AGENT` and `SCHEDULED` values, persisted on `BackgroundWorker.taskKind` and `TaskRun.taskKind` (plus a matching Clickhouse column), so the runs list can filter by kind. New `@trigger.dev/core` modules — `sessionStreams`, `inputStreams`, a `sessionStreamInstance` for realtime streams, and the `realtime-streams-api` / `session-streams-api` surfaces — expose the typed shapes that chat.agent will use to drive `session.out`. `ChatChunkTooLargeError` lets the runtime drop oversized chunks with a typed surface instead of failing the run. `s2Append` retries transient failures with exponential backoff. `/api/v[12]/packets/*` is exempt from customer rate limits so chat snapshot reads and writes don't get throttled under load. ## Stack Part of a 4-PR stack. Merge bottom-up. 1. **This PR** (#3542) → `main` 2. #3543 → #3542 — `chat.agent` runtime + browser transport 3. #3545 → #3543 — agent-view dashboard 4. #3546 → #3545 — ai-chat reference + MCP tooling Replaces #3173 (closed). <!-- GitButler Footer Boundary Top --> --- This is **part 5 of 5 in a stack** made with GitButler: - <kbd> 5 </kbd> #3612 - <kbd> 4 </kbd> #3546 - <kbd> 3 </kbd> #3545 - <kbd> 2 </kbd> #3543 - <kbd> 1 </kbd> #3542 👈 <!-- GitButler Footer Boundary Bottom -->
2a7d030 to
5fa5d3d
Compare
289ab08 to
e373556
Compare
5fa5d3d to
f8d5198
Compare
e373556 to
55d9543
Compare
f8d5198 to
a08c3a4
Compare
55d9543 to
2cd4c8f
Compare
a08c3a4 to
dc82bb6
Compare
2cd4c8f to
d3f90d7
Compare
dc82bb6 to
12b4525
Compare
d3f90d7 to
43e9f21
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (2)
packages/cli-v3/src/entryPoints/dev-run-worker.ts (1)
358-387:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winAdd
standardSessionStreamManager.reset()to lifecycle cleanup.The
resetExecutionEnvironment()function resets other stream managers (standardRealtimeStreamsManager,standardInputStreamManager) but omits the session stream manager. Without this reset, session stream state will persist across worker reuses, potentially leaking handlers, buffered records, and other internal state into subsequent task executions.🔧 Suggested fix
standardRealtimeStreamsManager.reset(); standardInputStreamManager.reset(); + standardSessionStreamManager.reset(); waitUntilManager.reset();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli-v3/src/entryPoints/dev-run-worker.ts` around lines 358 - 387, The resetExecutionEnvironment() lifecycle cleanup misses resetting the session stream manager, allowing session state to leak between runs; inside resetExecutionEnvironment() add a call to standardSessionStreamManager.reset() alongside the other resets (e.g., next to standardRealtimeStreamsManager.reset(), standardInputStreamManager.reset()) so session handlers, buffered records, and internal state are cleared on each worker reset..claude/architecture/sessions-as-run-manager.md (1)
292-294:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDesign should specify explicit recursion bounds.
The pathological recursion path at line 293 lacks an explicit retry limit or backoff policy in the design. While the comment at line 301 states recursion is "bounded by run-engine's own progress," this is an implicit bound. The design spec should prescribe explicit bounds (e.g., max 3 retry attempts with exponential backoff) to guide implementation and prevent indefinite loops or stack exhaustion in edge cases.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.claude/architecture/sessions-as-run-manager.md around lines 292 - 294, The design currently leaves the pathological recursion in ensureRunForSession(fresh, reason) unbounded; update the spec to require an explicit retry policy: limit retries (e.g., maxRetries = 3) and use exponential backoff with jitter (e.g., baseDelay x 2^attempt) between attempts, and prefer an iterative retry loop or tail-recursion to avoid stack growth; reference ensureRunForSession and the “run-engine” progress dependency and state when to abort (return an error/timeout) after maxRetries so implementations cannot recurse indefinitely.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In @.claude/architecture/sessions-as-run-manager.md:
- Around line 292-294: The design currently leaves the pathological recursion in
ensureRunForSession(fresh, reason) unbounded; update the spec to require an
explicit retry policy: limit retries (e.g., maxRetries = 3) and use exponential
backoff with jitter (e.g., baseDelay x 2^attempt) between attempts, and prefer
an iterative retry loop or tail-recursion to avoid stack growth; reference
ensureRunForSession and the “run-engine” progress dependency and state when to
abort (return an error/timeout) after maxRetries so implementations cannot
recurse indefinitely.
In `@packages/cli-v3/src/entryPoints/dev-run-worker.ts`:
- Around line 358-387: The resetExecutionEnvironment() lifecycle cleanup misses
resetting the session stream manager, allowing session state to leak between
runs; inside resetExecutionEnvironment() add a call to
standardSessionStreamManager.reset() alongside the other resets (e.g., next to
standardRealtimeStreamsManager.reset(), standardInputStreamManager.reset()) so
session handlers, buffered records, and internal state are cleared on each
worker reset.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 40ab6dd3-01f3-45c4-aee5-100b383b1308
⛔ Files ignored due to path filters (57)
.claude/scheduled_tasks.lockis excluded by!**/*.lockreferences/ai-chat/.gitignoreis excluded by!references/**references/ai-chat/.nvmrcis excluded by!references/**references/ai-chat/DEMO-SHORTHAND.mdis excluded by!references/**references/ai-chat/DEMO.mdis excluded by!references/**references/ai-chat/README.mdis excluded by!references/**references/ai-chat/next-env.d.tsis excluded by!references/**references/ai-chat/next.config.tsis excluded by!references/**references/ai-chat/package.jsonis excluded by!references/**references/ai-chat/postcss.config.mjsis excluded by!references/**references/ai-chat/prisma.config.tsis excluded by!references/**references/ai-chat/prisma/migrations/20260305112427_init/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/20260306165319_add_user_model/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/20260327180000_remove_user_tool/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/20260425091008_add_chat_model_and_user_github_token/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/20260425121916_add_session_id_to_chat_session/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/20260427053743_simplify_chat_session_for_run_manager/migration.sqlis excluded by!references/**references/ai-chat/prisma/migrations/migration_lock.tomlis excluded by!references/**references/ai-chat/prisma/reset-chats.sqlis excluded by!references/**references/ai-chat/prisma/schema.prismais excluded by!references/**references/ai-chat/src/app/actions.tsis excluded by!references/**references/ai-chat/src/app/api/chat/route.tsis excluded by!references/**references/ai-chat/src/app/chats/[chatId]/page.tsxis excluded by!references/**references/ai-chat/src/app/chats/layout.tsxis excluded by!references/**references/ai-chat/src/app/chats/page.tsxis excluded by!references/**references/ai-chat/src/app/globals.cssis excluded by!references/**references/ai-chat/src/app/layout.tsxis excluded by!references/**references/ai-chat/src/app/page.tsxis excluded by!references/**references/ai-chat/src/components/chat-app.tsxis excluded by!references/**references/ai-chat/src/components/chat-settings-context.tsxis excluded by!references/**references/ai-chat/src/components/chat-sidebar-wrapper.tsxis excluded by!references/**references/ai-chat/src/components/chat-sidebar.tsxis excluded by!references/**references/ai-chat/src/components/chat-view.tsxis excluded by!references/**references/ai-chat/src/components/chat.tsxis excluded by!references/**references/ai-chat/src/lib/chat-tools-schemas.tsis excluded by!references/**references/ai-chat/src/lib/chat-tools.tsis excluded by!references/**references/ai-chat/src/lib/code-sandbox.tsis excluded by!references/**references/ai-chat/src/lib/models.tsis excluded by!references/**references/ai-chat/src/lib/pr-review-helpers.tsis excluded by!references/**references/ai-chat/src/lib/pr-review-tools.tsis excluded by!references/**references/ai-chat/src/lib/prisma.tsis excluded by!references/**references/ai-chat/src/trigger/chat-client-test.tsis excluded by!references/**references/ai-chat/src/trigger/chat-tools.tsis excluded by!references/**references/ai-chat/src/trigger/chat.tsis excluded by!references/**references/ai-chat/src/trigger/pr-review.tsis excluded by!references/**references/ai-chat/src/trigger/skills/time-utils/SKILL.mdis excluded by!references/**references/ai-chat/src/trigger/skills/time-utils/references/timezones.txtis excluded by!references/**references/ai-chat/src/trigger/skills/time-utils/scripts/add.shis excluded by!references/**references/ai-chat/src/trigger/skills/time-utils/scripts/now.shis excluded by!references/**references/ai-chat/src/trigger/stress-emit.tsis excluded by!references/**references/ai-chat/src/trigger/test-chat.test.tsis excluded by!references/**references/ai-chat/src/trigger/test-chat.tsis excluded by!references/**references/ai-chat/trigger.config.tsis excluded by!references/**references/ai-chat/tsconfig.jsonis excluded by!references/**references/ai-chat/vitest.config.tsis excluded by!references/**references/hello-world/src/trigger/chatAgent.tsis excluded by!references/**references/hello-world/src/trigger/triggerAndSubscribe.tsis excluded by!references/**
📒 Files selected for processing (22)
.changeset/ai-tool-helpers.md.changeset/mcp-agent-chat-sessions.md.claude/architecture/chat-agent-sessions.md.claude/architecture/sessions-as-run-manager.md.claude/docs-plans/sessions-as-run-manager-docs.md.claude/review-guides/chat-agent-sessions-row-agnostic.md.claude/rules/package-installation.mdpackages/cli-v3/src/build/buildWorker.tspackages/cli-v3/src/build/bundleSkills.tspackages/cli-v3/src/dev/devSession.tspackages/cli-v3/src/dev/taskRunProcessPool.tspackages/cli-v3/src/entryPoints/dev-index-worker.tspackages/cli-v3/src/entryPoints/dev-run-controller.tspackages/cli-v3/src/entryPoints/dev-run-worker.tspackages/cli-v3/src/entryPoints/managed-index-controller.tspackages/cli-v3/src/entryPoints/managed-index-worker.tspackages/cli-v3/src/entryPoints/managed-run-worker.tspackages/cli-v3/src/mcp/config.tspackages/cli-v3/src/mcp/tools.tspackages/cli-v3/src/mcp/tools/agentChat.tspackages/cli-v3/src/mcp/tools/agents.tspackages/cli-v3/src/mcp/tools/tasks.ts
✅ Files skipped from review due to trivial changes (3)
- .claude/rules/package-installation.md
- .changeset/ai-tool-helpers.md
- .changeset/mcp-agent-chat-sessions.md
🚧 Files skipped from review as they are similar to previous changes (14)
- packages/cli-v3/src/mcp/tools/tasks.ts
- packages/cli-v3/src/entryPoints/managed-index-controller.ts
- packages/cli-v3/src/entryPoints/dev-index-worker.ts
- packages/cli-v3/src/dev/taskRunProcessPool.ts
- packages/cli-v3/src/mcp/tools.ts
- packages/cli-v3/src/entryPoints/managed-index-worker.ts
- packages/cli-v3/src/build/buildWorker.ts
- packages/cli-v3/src/mcp/config.ts
- packages/cli-v3/src/entryPoints/managed-run-worker.ts
- packages/cli-v3/src/mcp/tools/agentChat.ts
- packages/cli-v3/src/dev/devSession.ts
- packages/cli-v3/src/mcp/tools/agents.ts
- packages/cli-v3/src/entryPoints/dev-run-controller.ts
- packages/cli-v3/src/build/bundleSkills.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
- GitHub Check: internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
- GitHub Check: internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
- GitHub Check: typecheck / typecheck
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: audit
- GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
**/*.{ts,tsx}: Import from@trigger.dev/coresubpaths only, never from the root. Subpath imports must be used to maintain proper module boundaries.
When writing Trigger.dev tasks, always import from@trigger.dev/sdk. Never use@trigger.dev/sdk/v3or deprecatedclient.defineJob.
Prisma is version 6.14.0. Use the Prisma client frominternal-packages/databasefor all database operations.
For ClickHouse client, schema migrations, and analytics queries, useinternal-packages/clickhouse.
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Add crumbs as you write code — not just when debugging. Mark lines with
//@Crumbsor wrap blocks in `// `#region` `@crumbs. They stay on the branch throughout development and are stripped byagentcrumbs stripbefore merge.
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
packages/cli-v3/src/entryPoints/**/*
📄 CodeRabbit inference engine (packages/cli-v3/CLAUDE.md)
Code in
src/entryPoints/runs inside customer containers and is a different runtime environment from the CLI - changes affect deployed task execution directly
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
**/*.{ts,tsx,js,jsx,json,md,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Code formatting is enforced using Prettier. Run
pnpm run formatbefore committing
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
packages/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
When modifying any public package (
packages/*orintegrations/*), add a changeset usingpnpm run changeset:add. Default to patch for bug fixes and minor changes; confirm with maintainers before selecting minor; never select major without explicit approval.
Files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
🧠 Learnings (2)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).
Applied to files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.
Applied to files:
packages/cli-v3/src/entryPoints/dev-run-worker.ts
🪛 LanguageTool
.claude/architecture/sessions-as-run-manager.md
[grammar] ~8-~8: Ensure spelling is correct
Context: ... The previous branch made chatId (the externalId) the universal addressing string and ma...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~17-~17: ‘whether or not’ might be wordy. Consider a shorter alternative.
Context: ...dent — it appends to S2 successfully whether or not the run is alive. The transport's "n...
(EN_WORDINESS_PREMIUM_WHETHER_OR_NOT)
[style] ~418-~418: To elevate your writing, try using more formal phrasing here.
Context: ...nd-continue` returns conflict, agent v1 keeps running, processes message, retries upgrade l...
(CONTINUE_TO_VB)
[style] ~511-~511: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...oads incompatible with the new version. Probably defer — chat.agent contract is stabl...
(REP_PROBABLY)
.claude/docs-plans/sessions-as-run-manager-docs.md
[style] ~93-~93: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...hboard. ### ai-chat/compaction.mdx - Should be untouched (compaction lives inside `...
(MISSING_IT_THERE)
[style] ~96-~96: To form a complete sentence, be sure to include a subject or ‘there’.
Context: .... ### ai-chat/pending-messages.mdx - Should be untouched (steering messages flow th...
(MISSING_IT_THERE)
[grammar] ~126-~126: Ensure spelling is correct
Context: ...AndContinueSession(server-to-server), webapp atomically swapsSession.currentRunId`...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~137-~137: To form a complete sentence, be sure to include a subject.
Context: ...patterns/branching-conversations.mdx` - Should be mostly unchanged. Branching is a cus...
(MISSING_IT_THERE)
[style] ~143-~143: To form a complete sentence, be sure to include a subject.
Context: ...-chat/patterns/human-in-the-loop.mdx- Should be unchanged. ###ai-chat/patterns/sk...
(MISSING_IT_THERE)
[style] ~146-~146: To form a complete sentence, be sure to include a subject.
Context: ...d. ### ai-chat/patterns/skills.mdx - Should be unchanged. ## NEW page: upgrade gui...
(MISSING_IT_THERE)
.claude/review-guides/chat-agent-sessions-row-agnostic.md
[grammar] ~26-~26: Ensure spelling is correct
Context: ...s used to build the S2 stream path, the waitpoint cache key, and the JWT resource set — s...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~97-~97: Ensure spelling is correct
Context: .... **Question to ask:** what fires the waitpoint? An agent's session.in.wait()` register...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~140-~140: To elevate your writing, try using an alternative expression here.
Context: ...ne chatId converge to one row). The row matters for downstream metadata + listing, not ...
(MATTERS_RELEVANT)
[grammar] ~156-~156: Ensure spelling is correct
Context: ...unctionally either ID works (row lookup canonicalises), but the doc text is now out of date —...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~182-~182: Ensure spelling is correct
Context: ...port itself never puts it in a URL or a waitpoint key. The sendMessages path is worth ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~197-~197: Ensure spelling is correct
Context: ...he upsert, swap addressing identifiers, optionalise the friendlyId. If you've read `chat.ts...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 markdownlint-cli2 (0.22.1)
.claude/architecture/chat-agent-sessions.md
[warning] 72-72: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 102-102: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 155-155: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 181-181: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 204-204: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 231-231: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 254-254: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 288-288: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 394-394: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 405-405: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
.claude/architecture/sessions-as-run-manager.md
[warning] 59-59: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 473-473: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
.claude/docs-plans/sessions-as-run-manager-docs.md
[warning] 343-343: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (5)
packages/cli-v3/src/entryPoints/dev-run-worker.ts (2)
37-37: LGTM!Also applies to: 65-65
191-197: LGTM!.claude/architecture/chat-agent-sessions.md (1)
353-357: Stale follow-up item references already-migrated MCP chat tooling.This section lists
packages/cli-v3/src/mcp/tools/agentChat.tsas an unmigrated legacy consumer, but the PR stack context explicitly includes "MCP agent discovery & chat tools" (layer 7) with implementations for starting chats, sending messages, and closing chats. Please remove this entry from the "Known follow-ups" list or mark the section as historical snapshot-only..claude/docs-plans/sessions-as-run-manager-docs.md (1)
9-10: ⚡ Quick winSessionRun is treated as guaranteed here but optional/deferred in the architecture spec.
Line 9 states the Session "tracks every run it ever triggered in a
SessionRunaudit table," but the companion architecture spec (sessions-as-run-manager.mdlines 118-133) explicitly marks SessionRun as "Optional historical join (defer to v1.1)" and "Not strictly needed for v1." This inconsistency appears in multiple places (lines 90, 127, 317-318). Please use conditional language (e.g., "may track", "if the SessionRun table is present") to align with the architecture spec's deferred/optional treatment..claude/review-guides/chat-agent-sessions-row-agnostic.md (1)
1-288: LGTM!
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.) fix(cli): preserve lastEventId after sendMessage fallback to avoid stale turn-complete replay
Summary
A complete Next.js reference project that exercises
chat.agentend-to-end, plus the CLI MCP tools that let Claude Code, Cursor, and similar IDE agents drive a deployedchat.agenttask from the editor. Builds on #3545.Design
references/ai-chatis a full Next.js app: prisma-backed persistence, multi-chat sidebar, per-chat model picker, debug panel, tool examples (getCurrentTime,searchHackerNews,createGithubIssue, PR review helpers, code sandbox), and smoke tests. It's intended both as a copy-paste starting point and as a place to regression-test SDK changes.The CLI gains MCP tools (
start_agent_chat,send_agent_message,close_agent_chat,list_agents) so an IDE agent can converse with a deployedchat.agenttask. The dev runtime adds one-shot OOM kill on the run controller and skills bundling in the build pipeline.Test plan
cd references/ai-chat && pnpm install && pnpm trigger:devstart_agent_chatagainst the running dev task, send a message, verify the response streams backStack
Part of a 4-PR stack. Merge bottom-up.
main— Sessions dashboard + chat-ready hardeningchat.agentruntime + browser transportThis is part 2 of 5 in a stack made with GitButler: