Repository navigation
feat: model sessions as containers of linear threads - #112
Merged
Merged
Conversation
Replace every migration with one schema: a session holds threads with one event log, entries carry committed_seq, the inbox addresses a thread, and documents with full-value revisions hold per-thread state. The built-in agent document replaces session config; usage, execution and titles move to the thread. Fork is the only way to branch: it cuts at a committed entry, re-points the origin to the entry's owner and copies documents by policy. Runs are keyed by thread, and the server splits into session.* and thread.*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Walkthrough fork cut and agent copy, fork refusals, inherited origins, before(), concurrent threads, reset in context assembly, thread recovery and the structural constraints, each with an artifact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The widget's RPC mirror follows the thread.* split; the desktop server lists main threads and the session widget reads and prompts the main thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests address threads, read sessions through their main thread, and expect the log to open with session.created. Copy-on-fork tests are gone; server tests cover fork, before() and session delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review findings: a delete stops threads a prompt woke after its first interrupt, and a drain of a deleted thread runs nothing. thread.message counts inherited prompts, a commit moves the thread's last activity, run --thread rejects a malformed id, and a stale append seq is covered by a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… catalog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A session becomes a container of linear threads: one physical boundary, one event log, one seq space. Every session has exactly one
mainthread. The only way to branch is to fork a thread.Storage
202610290001_threads, which createssequence,event,sandbox,project,space,session,thread,entry,part,inbox,documentandrevision. Existing databases are discarded, not upgraded.session.createdis the first event of every session.Harness
session/session.ts) is the container. It handles create (with themainthread and itsagentdocument, in one event), link, relink and delete.relinkwith athreadIdsets only that thread'sagent.placement.thread/thread.ts) handles entries and parts,committed_seq, context through the fork line, and fork:committed_seq.before()refills the editor text.document/document.ts) stores full-value revisions. The built-inagentkind (model, thinkingLevel, modelTools, placement) replaces session config.thread.configuredwrites one revision.inbox/, previously session input): items are addressed to a thread and stored askind+data.agentis read once per request.interruptworks on one thread or on a whole session.sessionIdand asgen_ai.conversation.id.resetorcompaction. TheconfigChangeandbranchSummaryentry types are gone;systemandresetare added.APIs
session.*keepscreate(returns the main thread's info),link,relink(now takes an optionalthreadId),delete,interrupt(all threads) andlog.thread.*:list,info,history,queue,configure,fork,prompt,cancel,update,interrupt,messageandwait. Payloads are{ sessionId, threadId? }; a missingthreadIdmeans the main thread.run --session <id> --thread <id|main>. ACP maps an editor session to the main thread.ThreadIDis exported fromids, andSharedPluginContextandToolBefore/ToolAftergainthreadId.web,widget, the desktop server) show each session as its main thread.Tests
harness/test/thread.test.tsis an end-to-end test that writes artifacts. It covers:committed_seq, withagentcopied as of the cutbefore(), and its rejection on main's first entryserver.test.tscoversthread.fork,beforeandsession.deleteover WebSocket.vp checkandvp run typecheckpass.models.gen.json.Not in this PR
tool_search/tool_unavailable.🤖 Generated with Claude Code