Repository navigation
Split ai-chat into an abstract base with ai-chat-native and ai-chat-pty subtypes (closes #3446) - #3472
Conversation
Pragmatic Code Review: PR #3472Review Type: Initial Review (no prior reviews or comments on the PR; reviewed at Summary: The split is done the way ADR-088 §1–§2 and ADR-086 describe it. There is one definition per chat type in What I ran: Requirements Check (issue #3446 acceptance criteria)
Code Review Findings 🟡 Important1. The eval harness no longer excludes its own chat nodes from graph snapshots
2. The docs change the PR relies on has not landed
🟢 Suggestions3. The capture conflict retry has no test
4.
5. A non-message child of a chat is still not its own embedding root
6. A terminal chat only becomes
Nitpicks
Checked and found sound (areas the brief asked for scrutiny on)
Recommendation: REQUEST CHANGES Small in scope: fix finding 1 and land the docs commit (finding 2). Findings 3–6 and the nits are for |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: REQUEST CHANGES (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summary (commit
|
Pragmatic Code Review: PR #3472 (re-review)Review Type: Re-Review (commit Previous Review Summary: 6 findings and 3 nits. 5 findings and all 3 nits addressed, 1 finding skipped with a valid reason, 0 not addressed. New issues found: 0 Critical, 0 Important, 2 Suggestions, 2 nits. What I ran on
I did not re-run the full Status of the first review's findings
Requirements Check (issue #3446 acceptance criteria)
No node-type reject condition is introduced by this commit: no undeclared key, literal Code Review Findings (new in 🟢 Suggestions1.
2. The always-on write now reaches a node that is not a chat, if a caller passes one
Nitpicks
Checked and found sound (areas the brief asked about)
Recommendation: APPROVE Both Important findings from the first review are fixed, the skipped finding belongs to #3447, and this commit introduces no Critical or Important issue. The two suggestions and two nits are small and none blocks the merge. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summary, round 2 (commits
|
Pragmatic Code Review: PR #3472 (re-review 2)Review Type: Re-Review (commits Previous Review Summary: the re-review made 2 suggestions and 2 nits. All 4 are addressed, 0 not addressed, 0 skipped. New issues found in the two new commits: 0 Critical, 0 Important, 2 Suggestions, 3 nits. For the merge I reviewed the resolution ( What I ran on
I did not re-run the full Status of the re-review's findings
Requirements Check (issue #3446 acceptance criteria)
No node-type reject condition is introduced: no undeclared key, no literal Code Review Findings (new in 🟢 Suggestions1. The chat arms'
2. The docs sentence that still lists
Nitpicks
Checked and found sound (areas the brief asked about)
Recommendation: APPROVE Both suggestions and both nits from the re-review are fixed, the merge resolution is correct and loses nothing from either side, and neither new commit introduces a Critical or Important issue. Suggestion 1 has no effect on behaviour today; suggestion 2 is a one-sentence docs check to make before merging. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review 2): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summary, round 3 (commit
|
|
Merge queue: #3472 was taken out of the queue — it conflicts with main in: packages/core/src/models/ai_chat_node.rs, packages/core/src/models/mod.rs, packages/desktop-app/app-lib/src/types.rs, packages/nodespace-types/src/ai_chat.rs, packages/nodespace-types/src/convert.rs, packages/nodespace-types/src/lib.rs. Rebase onto origin/main, push, and re-run |
8768419 to
7063374
Compare
|
Merge queue: #3472 was taken out of the queue — it conflicts with main in: packages/daemon/src/services/local_agent_service.rs. Rebase onto origin/main, push, and re-run |
7063374 to
62672bb
Compare
…ty subtypes (closes #3446) ai-chat becomes an abstract base (ADR-088 §1-§2); a chat is an ai-chat-native (NodeSpace's agent loop) or an ai-chat-pty (an external agent in a terminal). Each chat type is defined once in nodespace-types; core's copy is deleted. - Base fields: agent (required), model, summary, last_active. Native: provider (native | openai-compat), turn_status, context_tokens, messages. PTY: session_status (active | ended), session_id, transcript, exit_code. - A finished terminal session always records its end on its ai-chat-pty node through the validated update, under bare field names; capture gates the summary and transcript. No capture: keys, started_at, ended_at or agent_type. - The mention-containers query resolves task and chat through the ancestry table instead of type literals. - Frontend: a plugin and viewer per subtype over the generated chat types; a chat is created as ai-chat-native and retyped when a terminal harness is picked; the AI Chats list queries the base type. - The generated registry entry carries typedUpdate. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
62672bb to
02dabb1
Compare
Closes #3446. Implements ADR-088 §1–§2 on the ADR-086 registry.
What changes
ai-chatbecomes an abstract base; a chat is always one of two core subtypes. Each AI-chat type is defined once, innodespace-types; core's copy (models/ai_chat_node.rs) is deleted.ai-chatagent(required, no default),model,summary,last_activeai-chat-nativemessages[]is nestedprovider(native|openai-compat),turn_status(idle|processing),context_tokens,messagesai-chat-ptysession_status(active|ended),session_id(local_only),transcript(local_only),exit_codeRemoved:
created_nodes(nothing wrote it), the stalemessages[]item-field declarations, theptyprovider,session_statuson native chats,archivedas a session value, everycapture:key, andmodelas a harness name.Rules (all inherited from the base through the registry): not embedded, not mentionable, no inbound references, children allowed, title required. No relationships added.
Backend
CoreNodeType::{AiChatNative, AiChatPty};AiChatNativeNodeandAiChatPtyNodeembed the envelope andAiChatBase, with closed enums for provider, turn status and session status. Each subtype promotes its whole chain, sopropertiescarries extension fields only.flatten_properties_for_apireads a core subtype's chain from the registry.session_id,transcript,summary,exit_code,last_activeandsession_status: endedthrough the validated, versioned update (retrying a version conflict). It no longer writesstarted_at,ended_atoragent_type.ai-chat-nativeonly; turn-status and message writes are patches of the fields they change instead of a rebuilt bucket.'task', 'ai-chat'by literal, so no chat (and no task subtype) was its own container once instances stopped being exactlyai-chat. It now goes through the ancestry table.Frontend
AiChatNativeNodeViewer,AiChatPtyNodeViewer) sharing one title header; no plugin for the abstract base.ai-chat-nativewithagent: nodespace. Picking a terminal harness retypes it toai-chat-pty, setsagentto the harness and clearsmodel; the pane re-resolves its viewer from the node's current type.sessionStatus/sessionId/summary/transcript/agent; "ended" issessionStatus === 'ended'.hasTypedCoreFieldsis split:hasTypedUpdatenow names only the types with a typed update command, since the chat subtypes promote fields but are written as property patches.Not in this PR
nodespace://links in terminal sessions (ADR-088 lists link decoration as separate follow-up work).Docs
The AI-chat sheets in
nodespace-docs/components/node-types.mdandarchitecture/ai-chat-node.mdalready describe these types and fields. A follow-on docs commit adjusts the creation flow ("created asai-chat-native, retyped when a harness is picked") and notes that retyping between chat subtypes is allowed.No migration: reset the database.
Tests
bun run test:changed: frontend (303 files / 5578 tests), browser, scripts and the Rust workspace all pass.core/tests/it/ai_chat_subtypes_test.rs: abstract base refused on every create and retype path; buckets, defaults and typed structs per subtype; closed buckets reject the other subtype's and the retired keys; closed enums; a base query returns both subtypes; no inbound references; retype only between chat types; children; title rule.ended, the validated write on a realai-chat-ptynode, and refusal on a node that is not a terminal chat.🤖 Generated with Claude Code