Skip to content

Finish SessionStore persistence and remove forwarding faces - #1904

Closed
eric8810 wants to merge 16 commits into
mainfrom
eric/1292-domain-session-storage
Closed

eric8810 wants to merge 16 commits into
mainfrom
eric/1292-domain-session-storage

Conversation

@eric8810

@eric8810 eric8810 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #1292

Callers and operations

  • Agents bootstrap → Session-scoped timelineStore. Agents, catalog, grants and worktree clients → store → sqliteStorage for createOwnedSession/fork/owner/creationRecord/hasRecords/sessionConfig/sessionConfigText/catalog/addGrant/removeGrant/grants/setSessionLanguage/associateWorktree/worktreeDirectories/worktreeUsages/sessionsUnderWorkspace/removeWorktreeDirectory.
  • Session deletion → hasRecords/removableOutputDirectories/touchWorktreeDirectories/rollbackSession; worktree removal uses the existing association checks. SessionTitle/rename → store.readMetadata/setTitle; FileAccess → store.associateWorktree. Migrate alternate profiles; remove sessionMetadata/worktreeAssociations after their last caller.
  • SessionFiles.read(fileId) → existing ownsFile; sweep → releaseStaleFileWriters/unownedFiles/deleteIfUnowned/recordedFiles. Reuse the seven shipped file/output ownership operations; keep OS work outside transactions.
  • Timeline → SQLite rollbackSession/releaseSession/readPage/readSegments/query/trace/saveSnapshot/latestSnapshot. Reuse commitTimelineRound and createSession/sessionConfig/branches/head/batchEnd/batchEndAt. SessionStore retains admission, publication, subscriptions, ownership lock, file I/O and drain. SQLite owns transactions and database lock.

Final API

Caller → owner API Transaction owner and boundary
Agents, Session catalog, grants and worktree clients → store → sqliteStorage Reuse the store request/reply shapes for createOwnedSession, fork, owner, creationRecord, hasRecords, sessionConfig, sessionConfigText, catalog, addGrant, removeGrant, grants, setSessionLanguage, associateWorktree, worktreeDirectories, worktreeUsages, sessionsUnderWorkspace, removeWorktreeDirectory. SQLite creates the Session, main branch, ownership and optional worktree association in one transaction. Fork uses bounded copy transactions on its own connection; only the final transaction inserts the Session row and makes the fork visible. Association commits the directory and Session link together.
Session deletion and worktree removal → store store.delete uses sqliteStorage.hasRecords, removableOutputDirectories, touchWorktreeDirectories, rollbackSession. store.removeWorktree uses the existing association/workspace checks and directory deletion. SessionStore holds its ownership lock across the checks, filesystem operation and row cleanup. SQLite owns each database step. File deletion and Git removal run outside SQL transactions.
SessionTitle and Session rename → store → sqliteStorage readMetadata(sessionId), setTitle(existing title request); existing metadata replies. FileAccess → store.associateWorktree with the existing association record. SQLite checks the title revision and commits the write. SessionStore serializes title writes and publishes the committed notice before admitting the next one.
Timeline clients → timelineStore; SessionStore → sqliteStorage Bind existing createSession, rollbackSession, releaseSession, sessionConfig, branches, head, batchEnd, batchEndAt, readPage, readSegments, query, trace, saveSnapshot, latestSnapshot requests at the native boundary. commitTimelineRound({batches: Append[]}) → {sessions: [{sessionId, result}]} accepts ordered batches grouped by Session. SessionStore admits appends synchronously, groups the existing writer round, and serves commit subscriptions and release/drain. SQLite owns encoding, the grouped transaction, per-Session fallback on failure and writer memo settlement. One accepted round produces the existing ordered batch outcomes after commit. Release or unload drops generation-local reader/writer state after drain.
Session file put/import and read → sessionFiles → sqliteStorage reserveFile(sessionId,fileId,generation), commitFile(sessionId,fileId,generation), abandonFile(fileId,generation); ownership and path reads via ownsFile, ownsOutput, ownedPaths; registerOutput(sessionId,path). SessionStore reserves, writes or imports bytes through the file owner, then finalizes. SQLite verifies the Session and writer generation, clears the reservation and inserts ownership atomically. Bytes, path validation and fileId transfer stay with the file owner.
Session file sweep → sqliteStorage releaseStaleFileWriters(generation), unownedFiles(), deleteIfUnowned(fileId), recordedFiles(names). SessionStore removes files outside SQLite. SQLite rechecks ownership when deleting the row. Failed cleanup remains retryable.
StorageMethods → sqliteStorage; native Transport → SQLite readiness storage.report calls sqliteStorage.storageReport({}). Transport gates endpoint binding on the storage face. SQLite owns the report and holds the database lock before readiness. Transport performs no storage read.

Append = {sessionId,branchId,batchId,events: StoredEvent[]}. Each distinct Session receives its existing success or CommitFailure {code,message}.

Verification

  • Native storage and SessionFiles flows passed (172 storage cases and eight SessionFiles cases). Ten worktree transport cases passed.
  • The Node process exercised SQLite paging, segments, counts, traces, snapshots, release/rollback and title revisions through the production dispatcher. Native reads observed the same committed state.
  • The generated assembly no longer exposes sessionStore. The title and worktree callers use store. Clippy and xtask check passed.

Owner contract · Baseline catalog

@eric8810 eric8810 mentioned this pull request Nov 20, 2026
6 of 45 tasks
@eric8810
eric8810 marked this pull request as ready for review November 20, 2026 09:48

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

I reviewed the merge-base diff for fdc700a3d4416630a27cf7266c3d9a99dba35fba, focusing on the SessionStore-to-SQLite storage dispatch, timeline binding, session metadata/title, file ownership, catalog, and worktree callers. I found no blocking issues in that scope.

The current head consolidates those operations behind the SQLite-backed store and removes the legacy forwarding faces. The corresponding caller and flow changes are present in crates/dim-app-server/src/storage/{catalog.rs,face.rs,files.rs,metadata.rs,sqlite.rs,timeline.rs}, crates/dim-agent-runtime/src/timeline_store_face.rs, crates/dim-app-server/src/agents.rs, and the updated title, TypeScript-process, worktree, and legacy-session tests.

Checks: For this exact head, GitHub reports changes and dependencies passed; verify was queued, while web, windows-cli, and acp-registry were skipped. Tests not run locally; the code and test coverage above were checked by static inspection. This is a non-blocking COMMENT, not an approval.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address these four merge blockers.

  1. Preserve committed Sessions during fork cleanup. The failure path in copy_fork cleans by destination ID without establishing that the current attempt owns the rows. This can remove an already committed Session. Reserve the destination before copying and limit cleanup to rows owned by the current attempt. Fork cleanup
  2. Serialize worktree association with removal. The SQLite association dispatch can write outside the ownership mutex that SessionStore holds across the usage check and Git removal. This can leave a recorded association to a removed directory. Require both operations to share the SessionStore synchronization boundary. Association dispatch · Removal boundary
  3. Preserve the worktree association error contract. The generic Store error mapping returns closed for a missing Session, while the accepted store.associateWorktree contract specifies failed with a message. Preserve that mapping and assert it through the production dispatcher. Store dispatch · Accepted contract
  4. Regenerate the service catalog. xtask check failed twice on the GitHub merge tree because the generated sqliteStorage row omits the dispatched readMetadata and setTitle operations. Regenerate the catalog and rerun the check. Generated catalog

The first three findings are from code inspection. On GitHub merge tree 1b412fe38a7bc865951a1388b87e2898deb11c3d, 42 focused checks passed in isolated Linux testing (40 Rust tests, including three Node-backed flows, and two plugin SDK tests). The ADR check also passed. GitHub changes and dependencies passed, and macOS verify is still running. CI run

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

This PR finishes the SessionStore persistence split described in docs/design/contracts/resource-owner-operations.md. Callers use the Session-scoped store and timelineStore; the repository, file-sweep, title and Timeline operations are bound on sqliteStorage; sessionStore, sessionMetadata and worktreeAssociations are removed; SessionStore keeps admission, publication, subscriptions, the ownership lock, file I/O and drain. I reviewed the full origin/main...HEAD diff at fdc700a, not only the last increment.

The store paths keep their transactions, ownership lock and publication behavior, and the targeted suites pass. Two things block: the generated service catalog is stale, so the required verify job fails at xtask check; and the title contract still documents read while the service exposes readMetadata. The new raw sqliteStorage operations also differ from the store and timelineStore contracts they are picked from; those are P3 because production callers still use store.

Blocking findings

P2: docs/architecture/rust-agent/generated/catalog.md is stale; CI verify fails

Problem. SqliteDispatch::methods lists readMetadata and setTitle (crates/dim-app-server/src/storage/sqlite.rs:2550-2551), and the handlers exist (crates/dim-app-server/src/storage/sqlite.rs:2764-2772), but the generated sqliteStorage row omits both (docs/architecture/rust-agent/generated/catalog.md:60). cargo run --locked -p xtask -- check at fdc700a exits 1 with catalog table is stale; run cargo run -p xtask -- graph. GitHub CI confirms it: job verify (136211356661) fails at target/debug/xtask check with the same message, and ci-ok fails with it.

Failure scenario. The required verify gate fails, so the PR cannot merge. The generated catalog is also the authoritative assembly description for plugin authors, so it hides two public methods that npm/plugin.d.ts:623,661-662 already exposes.

Evidence. docs/architecture/rust-agent/generated/catalog.md:60; crates/dim-app-server/src/storage/sqlite.rs:2550-2551; .github/workflows/ci.yml:194; CI job 136211356661. Running cargo run --locked -p xtask -- graph changes only this row, adding readMetadata and setTitle; xtask check then passes the remaining checks (module boundaries 742 modules and 4558 edges, crate and module boundaries, 26 plugin documents, service catalog, service declarations, plugin locks, 97 comment links, literal main).

Fix. Run cargo run --locked -p xtask -- graph and commit the regenerated catalog.md.

P2: title contract documents read; the code exposes readMetadata

Problem. The service is store with readMetadata and setTitle: the dispatcher lists readMetadata (crates/dim-app-server/src/storage/face.rs:378), Store::read_metadata is at crates/dim-app-server/src/storage/metadata.rs:344, and the TypeScript type and fixture use readMetadata (npm/plugin.d.ts:661, runtime/fixtures/session-metadata.ts:26). The same design document already says readMetadata at line 28 and read_metadata in Appendix A, but its section 4.1 table still says read (docs/design/appserver/session-title-metadata.md:90), section 4.2 says call read (docs/design/appserver/session-title-metadata.md:108), section 12 Modes says read (docs/design/appserver/session-title-metadata.md:282), acceptance item 4 says read (docs/design/appserver/session-title-metadata.md:334), and D8 says the service uses read and the Rust binding uses read (docs/design/appserver/session-title-metadata.md:371). docs/design/plugins/SessionTitle.md:383 repeats read while docs/design/plugins/SessionTitle.md:411 uses store.readMetadata. The zh mirrors repeat both forms (docs/zh/design/appserver/session-title-metadata.md:3,69,85, docs/zh/design/plugins/SessionTitle.md:316).

Failure scenario. A plugin author or reviewer following the contract implements store.read; Store::invoke rejects it as an unknown method (crates/dim-app-server/src/storage/face.rs:370-381 lists readMetadata, not read), so the title read fails. The document also contradicts itself and cannot be used to verify the final API.

Evidence. crates/dim-app-server/src/storage/face.rs:370-385; crates/dim-app-server/src/storage/metadata.rs:344-357; npm/plugin.d.ts:623,661; runtime/fixtures/session-metadata.ts:26; docs/design/appserver/session-title-metadata.md:28,90,108,282,334,371; docs/design/plugins/SessionTitle.md:383,411; docs/zh/design/appserver/session-title-metadata.md:3,69,85; docs/zh/design/plugins/SessionTitle.md:316.

Fix. Rename the method to readMetadata/read_metadata in all four title documents and the zh mirrors. This service is new in this PR, so there is no compatibility reason for a read alias.

Non-blocking findings

P3: the raw sqliteStorage operations do not preserve the store and timelineStore contracts

The new sqlite face is typed as SqliteStorage extends Pick<Store, ...>, Pick<TimelineStore, ...> (npm/plugin.d.ts:623), but several operations are raw storage steps with different semantics:

  • releaseSession and rollbackSession (crates/dim-app-server/src/storage/sqlite.rs:2797-2807) call SqliteStorage::release_session (crates/dim-app-server/src/storage/timeline.rs:527-536), which only clears the defaults and timeline_memo caches. They do not send Command::Release (the timelineStore drain at crates/dim-app-server/src/storage/timeline.rs:2900-2922, handler at crates/dim-app-server/src/storage/timeline.rs:271-281) and do not clear the writer's per-Session failure. TimelineStore.releaseSession says "Drain accepted storage writes" (npm/plugin.d.ts:731), and the contract says "Release or unload drops generation-local reader/writer state after drain" (docs/design/contracts/resource-owner-operations.md:58). A plugin that appended through the Session timelineStore and then calls sqliteStorage.releaseSession before unload can still have queued batches commit afterwards.
  • setTitle (crates/dim-app-server/src/storage/sqlite.rs:2767-2771) calls SqliteStorage::set_title directly, so it commits without the title writer's serialization and without the Session broadcast notice that SessionStore::set_title performs (crates/dim-app-server/src/storage/metadata.rs:158-182,213-250). A plugin using the sqlite face sets a title that attached v3 clients never learn through a notice.
  • Repository errors use storage_failure (crates/dim-app-server/src/storage/sqlite.rs:3128-3134), which maps Closed to cancelled and InvalidInput to storage_unavailable, while the same operations on store use failure (crates/dim-app-server/src/storage/face.rs:529-536) and report closed and invalid; the contract for these operations is invalid, closed, cancelled, storage (docs/design/resource-faces.md:787-793). For example, sqliteStorage.setSessionLanguage on a missing Session returns cancelled, and sqliteStorage.removeWorktreeDirectory on a still-associated directory returns storage_unavailable instead of invalid. The Node fixture compares the sqlite and store success values and checks the store face's error codes, but has no sqlite error-code case (runtime/fixtures/store.ts:49-52,176-200), so nothing catches this.
  • AssociateWorktree, Fork, CreateOwnedSession and RemoveWorktreeDirectory (crates/dim-app-server/src/storage/sqlite.rs:2925-2963) call the SqliteStorage methods directly. They do not take SessionStore.ownership (taken at crates/dim-app-server/src/storage/timeline.rs:1471,1505,1528,1564,1597), SqliteStorage::fork_session does not check the Session id (crates/dim-app-server/src/storage/timeline.rs:3756), and the raw create skips the cwd check that SessionStore applies (crates/dim-app-server/src/storage/timeline.rs:1528-1535,3826). A plugin can call sqliteStorage.associateWorktree concurrently with store.removeWorktree: the association commits without the lock, the removal can pass its usage check, remove the directory, and then fail its final association recheck, leaving the directory removed while the record or association remains. npm/plugin.d.ts:688 already warns that these operations run under the ownership mutex.

This is P3 because no in-tree production caller uses the raw steps (the Node storefixture and tests do), and the store and timelineStore faces remain correct. If the raw face is intended for trusted plugins, the simplest fix is to keep these methods off the SDK SqliteStorage interface (or document them as storage-only), and preserve the store's error codes and drain where the same names are kept.

P3: stale architecture and design references to removed services

These documents still describe services this PR removes, so they no longer match the code and the generated catalog:

  • docs/architecture/rust-agent/single-tree.md:139 says SessionStorePlugin provides sessionMetadata and worktreeAssociations, and docs/architecture/rust-agent/single-tree.md:152 says AgentsPlugin injects sessionMetadata (SessionMetadataService) and assembles the TimelineStore from the native SessionStore. The head injects Key<Store> and Key<SqliteStorage> (crates/dim-app-server/src/agents.rs:2128) and binds the timeline through Store::bind_timeline (crates/dim-app-server/src/storage/face.rs:21-23).
  • docs/architecture/rust-agent/timeline-storage.md:12-13 says sessionMetadata and worktreeAssociations keep their interfaces, and docs/architecture/rust-agent/timeline-storage.md:21 names worktreeAssociations.associate in the ownership-lock rule.
  • docs/design/plugin-contract.md:110 still lists sessionMetadata as a process service provided by SessionStore; the zh mirror is docs/zh/design/plugin-contract.md:99.
  • docs/design/overview.md:508 says S5b is implemented as the sessionMetadata service; the zh mirror is docs/zh/design/overview.md:507.
  • docs/design/appserver/session-deletion-and-fork.md:849 says SessionStore provides worktreeAssociations to the Session file-facts owner; the zh mirror is docs/zh/design/appserver/session-deletion-and-fork.md:539.
  • docs/design/resource-faces.md:793 and docs/design/service-faces.md:325 still say to retire sessionMetadata and worktreeAssociations when their callers migrate; this PR is that migration.

Fix: update these references to store, store.associateWorktree and store.readMetadata/store.setTitle, or delete the rows, in the same PR. I did not anchor these inline because they are outside the diff hunks.

What holds at fdc700a

  • The removed faces have no remaining callers in code. SessionMetadataService, WorktreeAssociations, sessionStore, sessionMetadata and worktreeAssociations appear only in docs at head; AgentsPlugin injects Key<Store> and Key<SqliteStorage> (crates/dim-app-server/src/agents.rs:2128), SessionTitle uses Key<Store> (crates/dim-session-title/src/lib.rs:142), and FileAccessFacts calls the store dispatch (crates/dim-agent-capabilities/src/file_access.rs:341-345,395). The generated catalog and services.json are updated for the removed names, apart from the stale readMetadata/setTitle row above.
  • The store paths still hold the ownership lock across the checks, the filesystem step and the row cleanup: SessionStore::delete_session (crates/dim-app-server/src/storage/timeline.rs:1469-1480), fork_session (crates/dim-app-server/src/storage/timeline.rs:1496-1508), create_owned_session (crates/dim-app-server/src/storage/timeline.rs:1517-1550), associate_worktree (crates/dim-app-server/src/storage/timeline.rs:1557-1578) and remove_worktree (crates/dim-app-server/src/storage/timeline.rs:1608-1628). Each sqlite step is one transaction (SqliteStorage::create_owned_session crates/dim-app-server/src/storage/timeline.rs:3826, associate_worktree crates/dim-app-server/src/storage/timeline.rs:3888, remove_worktree_directory crates/dim-app-server/src/storage/timeline.rs:3787), and SessionStore::delete_session still drains the writer before deleting rows (crates/dim-app-server/src/storage/timeline.rs:2892-2898).
  • Admission, publication and subscriptions on timelineStore are unchanged: TimelineStoreBinding, the writer round, commit_round and the per-Session outcomes are not modified; the moved reads call the same read_range, batch_end, save_snapshot and latest_snapshot code.
  • Session file ownership is unchanged: owns_file, removable_output_directories, release_stale_file_writers, unowned_files, delete_if_unowned and recorded_files are verbatim moves of the previous SQL, with the same ownership rechecks; session_files_flow passes all eight cases.
  • Legacy test coverage was replaced, not lost: the removed WorktreeAssociations tests cover a type that no longer exists, the new store-dispatch path is covered by crates/dim-agent-capabilities/tests/permission_flow/worktrees.rs, and the store-face title and worktree flows are covered by transport_flow/titles.rs and the Node store.ts fixture.

Verification

Isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR, LC_ALL=en_US.UTF-8, worktree clean and detached at fdc700a.

  • git diff --check origin/main...HEAD: pass.
  • git merge-tree --write-tree origin/main HEAD against current main b15bc92: pass, tree 3d29d83f3d544b7f80bb03cca5257e666e681b0e.
  • cargo fmt --all -- --check: pass.
  • node scripts/adr-check.mjs --base origin/main: pass, 34 changed files.
  • cargo run --locked -p xtask -- check: fails on the stale catalog above. After xtask graph regenerates catalog.md, the remaining checks pass: module source boundaries (742 modules, 4558 edges), crate and module boundaries, 26 plugin documents, service catalog, service declarations, plugin locks, 97 comment links, literal main.
  • cargo test -p dim-app-server --test storage_flow: 172 passed, 1 ignored.
  • cargo test -p dim-app-server --test storage_session_flow: 3 passed.
  • cargo test -p dim-app-server --test session_files_flow: 8 passed.
  • cargo test -p dim-app-server --test transport_flow titles: 5 passed, 1 ignored (Node).
  • cargo test -p dim-app-server --test transport_flow worktrees: 9 passed.
  • cargo test -p dim-app-server --test transport_flow process_typescript: 1 passed, 18 ignored (Node).
  • cargo test -p dim-app-server --lib --features testing: 125 passed.
  • cargo test -p dim-agent-capabilities --test permission_flow: 34 passed (includes the worktree store-dispatch cases).
  • cargo test -p dim-agent-capabilities --test legacy_session_faces: 4 passed.
  • cargo test -p dim-agent-runtime --lib: 5 passed.
  • cargo test -p dim-session-title: 25 passed across its test binaries.

Unverified

  • Node-gated tests: runtime/node_modules is absent and DIM_TEST_NODE/DIM_TEST_JS_RUNTIME are unset, so the ignored transport_flow/titles Node case, the 18 ignored process_typescript cases, and runtime/plugin-sdk.test.mjs did not run. The JSON dispatch shapes they cover were checked statically and with a small serde probe; the actual Node run rests on CI and the author's run.
  • I did not run App Server Clippy, the full workspace suite, or Windows-specific tests.
  • The sqliteStorage error-code and release-drain paths have no native test; the Node fixture checks store-face error codes but has no sqlite error-code case, so the P3 findings above are from reading the code and the contract.

CI and head

Head fdc700a, PR open and not a draft, GitHub reports MERGEABLE and mergeStateStatus UNSTABLE. CI: verify failed (stale catalog), ci-ok failed, dependencies and changes passed, web, windows-cli and acp-registry skipped.

Prior review and cross-PR

  • The prior review is codoggy COMMENTED at this head (review 5990844492) with no inline comments. It reported no blocking issues and said tests were checked by static inspection only; its checks were the GitHub jobs while verify was still queued, so it missed the stale catalog and the CI verify failure. There are no existing threads to reply to.
  • Merge base is b623ac6, so the diff isolates this PR; current origin/main is b15bc92. Main includes #1946 (snapshot deletion), #1940 (ADR 026), #1925 (ci-changes) and #1937; the PR does not touch their files, and the merge tree is clean.

@eric8810
eric8810 requested a review from yyhhyyyyyy November 20, 2026 10:36

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

This PR finishes the SessionStore persistence split in docs/design/contracts/resource-owner-operations.md: callers use the Session store and timelineStore; repository, file-sweep, title and Timeline operations are bound on sqliteStorage; sessionStore, sessionMetadata and worktreeAssociations are removed. I reviewed the full origin/main...HEAD diff at 5d8ce56, not only the increment. Merge base is b15bc92 and current main is 3d5749c.

The catalog blocker is fixed and the new raw-face locking and error mapping hold. One blocker remains in the same title contract: the rename this PR applies to Appendix G kept the old Rust method name, so the document still tells Rust implementers to call Store::read.

Prior findings

  • P2 catalog stale: fixed in 5d8ce56. docs/architecture/rust-agent/generated/catalog.md:60 now lists readMetadata and setTitle, and cargo run --locked -p xtask -- check passes at head. Withdrawn.
  • P2 title contract says read: partly fixed in 5d8ce56. Every location named in the prior review now says readMetadata/read_metadata in both languages, but Appendix G, which this PR rewrote, still says Store::read and async fn read in both languages. Kept as the blocking finding below.
  • P3 raw sqliteStorage differs from store/timelineStore: partly fixed. The ownership mutex now lives on SqliteStorage and is taken by the raw Fork, CreateOwnedSession, RemoveWorktreeDirectory and AssociateWorktree paths, so a store.removeWorktree cannot interleave with an association. The release/rollback drain, the raw setTitle notice, the raw fork id check and the raw create cwd check remain, as optional P3 below.
  • P3 stale service references: partly fixed. single-tree, timeline-storage, plugin-contract and overview now say store; the files and lines below remain, as an optional P3.
  • P3 zh title doc line 3: not fixed, kept as optional P3 below.

Blocking finding

P2: Appendix G documents Store::read; the Rust binding is read_metadata

Problem. The PR rewrites the title binding in Appendix G from SessionMetadataService::read to Store::read (docs/design/plugins/SessionTitle.md:506) and the code block from SessionMetadataService to Store while leaving async fn read (docs/design/plugins/SessionTitle.md:514). The Rust binding is Store::read_metadata (crates/dim-app-server/src/storage/metadata.rs:344), and the same document's section 4.2 (docs/design/appserver/session-title-metadata.md:109) and service table (docs/design/plugins/SessionTitle.md:383) already say read_metadata/readMetadata. The zh mirror repeats both wrong occurrences (docs/zh/design/plugins/SessionTitle.md:436,443).

Failure scenario. A Rust plugin author implementing the binding from Appendix G writes Store::read or store.read(...). The method does not exist, so the code does not compile and the appendix cannot be used to verify the final API. The contract contradicts itself in the same file, exactly as the prior finding described for the other sections.

Evidence. docs/design/plugins/SessionTitle.md:506,514; docs/zh/design/plugins/SessionTitle.md:436,443; crates/dim-app-server/src/storage/metadata.rs:344-346; docs/design/appserver/session-title-metadata.md:109; docs/design/plugins/SessionTitle.md:383,411.

Fix. Rename the table cell and the code block signature to Store::read_metadata in both languages. This is one line each; the method is new in this PR, so no alias is needed. The table cell is anchored inline.

Optional findings (P3, non-blocking)

P3: sqliteStorage.releaseSession and rollbackSession still skip the drain; setTitle skips the notice

Problem. Request::ReleaseSession calls SqliteStorage::release_session (crates/dim-app-server/src/storage/timeline.rs:527-536), which clears the defaults and timeline_memo caches only. Request::RollbackSession calls SqliteStorage::rollback_session (crates/dim-app-server/src/storage/timeline.rs:537-544), which deletes rows without the writer's Command::Release drain or the admission-failure clear that SqliteTimelineStore performs (crates/dim-app-server/src/storage/timeline.rs:271-281,2898-2920). Request::SetTitle calls SqliteStorage::set_title directly (crates/dim-app-server/src/storage/sqlite.rs:2770-2774), bypassing TitleWriter::settle and its notify (crates/dim-app-server/src/storage/metadata.rs:158-183). SqliteStorage is typed as Pick<TimelineStore, "releaseSession" | "rollbackSession"> and Pick<Store, "setTitle"> (npm/plugin.d.ts:623), whose docs promise a drain and a notice.

Failure scenario. A plugin that appended batches through its Session timelineStore and then calls sqliteStorage.rollbackSession deletes the rows, and the queued batches can still commit afterwards, leaving Timeline rows for a Session row that no longer exists. A plugin that calls sqliteStorage.releaseSession before unload can have queued batches commit after it returns, and a prior commit failure stays in the writer. A plugin that calls sqliteStorage.setTitle changes the stored title, but attached v3 clients receive no session.notice and keep the old title until a reload.

Evidence. crates/dim-app-server/src/storage/sqlite.rs:2770-2774,2800-2810; crates/dim-app-server/src/storage/timeline.rs:271-281,527-544,2898-2920; crates/dim-app-server/src/storage/metadata.rs:158-183,349-357; npm/plugin.d.ts:623,731; docs/design/contracts/resource-owner-operations.md:58; docs/design/plugins/SessionTitle.md:42.

Fix. If this face is storage-only, remove releaseSession, rollbackSession and setTitle from the SqliteStorage Pick and document them as raw steps. Otherwise route them through the SessionStore binding so the drain and the notice happen. The setTitle arm is anchored inline.

P3: raw fork and createOwnedSession still skip two Store checks

Problem. Request::Fork calls SqliteStorage::fork_session (crates/dim-app-server/src/storage/timeline.rs:3754-3783), which does not call check_session_id, while the store checks both ids (crates/dim-app-server/src/storage/timeline.rs:1498-1499). Request::CreateOwnedSession calls SqliteStorage::create_owned_session (crates/dim-app-server/src/storage/timeline.rs:3824-3884), which checks the id but not that config.cwd is an existing directory, while the store checks it (crates/dim-app-server/src/storage/timeline.rs:1522-1533). The SDK type inherits the comment that "Create/fork/delete reject ids that are not one normal path component" (npm/plugin.d.ts:623,659).

Failure scenario. A plugin calls sqliteStorage.fork with a destination id that is not one path component. The fork commits rows for that id, and a later store.delete of the id fails invalid at crates/dim-app-server/src/protocol.rs:723-731 before it removes anything, so the Session and its file and Timeline rows stay behind. A plugin calls sqliteStorage.createOwnedSession with a missing cwd. The Session row commits and the Session loads with a workspace that does not exist.

Evidence. crates/dim-app-server/src/storage/sqlite.rs:2929-2949; crates/dim-app-server/src/storage/timeline.rs:1498-1499,1522-1533,3754-3761,3824-3834; npm/plugin.d.ts:623,659; crates/dim-app-server/src/protocol.rs:723-731.

Fix. Call check_session_id at the top of SqliteStorage::fork_session and repeat the cwd check in SqliteStorage::create_owned_session. Alternatively drop these methods from the SDK Pick and document them as storage steps that trust their caller.

P3: the new ownership lock on sqliteStorage.createSession is not in the callback exclusion lists

Problem. 110df8f makes Request::CreateSession take db.ownership (crates/dim-app-server/src/storage/sqlite.rs:2850-2855). SessionStore::remove_worktree holds the same mutex across its plugin callback (crates/dim-app-server/src/storage/timeline.rs:1599-1612), and both the SDK comment and the contract list the operations a removal callback must not await (npm/plugin.d.ts:688, docs/design/resource-faces.md:770-773). createSession is missing from both lists. The timelineStore.createSession route does not take the mutex at all (crates/dim-agent-runtime/src/timeline_store_face.rs:129-135), so the creation exclusion is one-sided.

Failure scenario. A worktree removal callback that awaits sqliteStorage.createSession deadlocks. The removal holds the mutex and waits for the callback; the create waits for the mutex. The same creation through timelineStore.createSession can insert a Session row after the removal's sessions_under_workspace check.

Evidence. crates/dim-app-server/src/storage/sqlite.rs:2850-2855; crates/dim-app-server/src/storage/timeline.rs:1599-1612; npm/plugin.d.ts:688; docs/design/resource-faces.md:770-775; crates/dim-agent-runtime/src/timeline_store_face.rs:129-135.

Fix. Take the lock inside SqliteStorage::create_session so both routes share it, and add createSession to both exclusion lists. If the bare insert is not an ownership operation, drop the lock from this arm instead. The lock is anchored inline.

P3: residual zh and service references

Problem. These document locations still contradict the code.

  • docs/zh/design/appserver/session-title-metadata.md:3 says the callers switch to store and then store is removed; the English version deleted the sentence.
  • docs/design/appserver/session-deletion-and-fork.md:849 and docs/zh/design/appserver/session-deletion-and-fork.md:539 still say SessionStore provides worktreeAssociations.
  • docs/design/resource-faces.md:793 and docs/design/service-faces.md:325 still say to retire sessionMetadata and worktreeAssociations when their callers migrate, which this PR does.

Failure scenario. A Chinese reader concludes the target store binding itself is retired. A reader looking for worktreeAssociations in the generated catalog finds no such service.

Evidence. The lines above; docs/architecture/rust-agent/generated/catalog.md:60-61 has no sessionMetadata or worktreeAssociations row.

Fix. Delete the zh sentence and update or delete the service references above.

What holds at 5d8ce56

  • The store face keeps its ownership lock and transaction boundaries, and the mutex moved to SqliteStorage so SessionStore and SqliteDispatch share one instance (crates/dim-app-server/src/storage/timeline.rs:1466,1500,1523,1583,1599,3893; crates/dim-app-server/src/storage/sqlite.rs:2851,2930,2937,2958). No in-tree path enters a locked operation from another locked operation; the only callback-held path is removeWorktree, documented.
  • The association/removal race is closed: SqliteStorage::associate_worktree takes the mutex and rechecks the root (crates/dim-app-server/src/storage/timeline.rs:3893-3901), and the Node fixture starts a late association during removal and expects the root-missing failure (runtime/fixtures/store.ts:162-177).
  • Fork refuses an existing destination before copying (crates/dim-app-server/src/storage/timeline.rs:2443-2452), so a duplicate or retried fork cannot delete a committed Session; the new storage case keeps other after a failed fork (crates/dim-app-server/tests/storage_flow/worktrees.rs:48-60). The source without a root branch now fails Closed before writing anything.
  • Error codes are preserved on the store face and matched on the raw face: catalog, fork, createOwnedSession, removeWorktreeDirectory and the SessionRows methods use face::failure, and associateWorktree returns the accepted failed code (crates/dim-app-server/src/storage/face.rs:526-548; docs/design/service-faces.md:317-325). File and Timeline operations keep their own mappings.
  • The removed faces have no remaining code callers; the generated catalog and service declarations are current.

Verification

Isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR under the data directory, LC_ALL=en_US.UTF-8, worktree clean and detached at 5d8ce56.

  • git diff --check origin/main...HEAD: pass.
  • git merge-tree --write-tree origin/main HEAD against current main 3d5749c: clean, tree 509a81bc80b677446071fa2f1de2dab8eebd1c6a.
  • cargo fmt --all -- --check: pass.
  • node scripts/adr-check.mjs --base origin/main: pass, 41 changed files.
  • cargo run --locked -p xtask -- check: pass (742 modules and 4558 edges, crate and module boundaries, 26 plugin documents, service catalog, service declarations, plugin locks, 97 comment links, literal main).
  • cargo test -p dim-app-server --test storage_flow: 172 passed, 1 ignored.
  • cargo test -p dim-app-server --test storage_session_flow: 3 passed.
  • cargo test -p dim-app-server --test transport_flow worktrees: 9 passed.
  • cargo test -p dim-app-server --test transport_flow titles: 5 passed, 1 ignored.
  • cargo test -p dim-app-server --lib --features testing: 125 passed.
  • cargo test -p dim-agent-capabilities --test permission_flow worktree: 4 passed (30 filtered out).
  • cargo test -p dim-agent-capabilities --test legacy_session_faces: 4 passed.
  • cargo test -p dim-agent-runtime --lib: 5 passed.
  • cargo test -p dim-session-title: 25 passed across the binaries.

Unverified

  • Node-gated tests did not run: runtime/node_modules is absent, so the new late-association case in runtime/fixtures/store.ts:162-177, the setSessionLanguage parity case at 241-242, the addGrant cases at 243-246, the ignored transport_flow/titles Node case and the 18 ignored process_typescript cases rest on CI and the author's run.
  • The release/rollback drain, the raw setTitle notice, the raw fork id check and the raw create cwd check are from code reading; no native test covers them.
  • I did not run App Server Clippy, the full workspace suite or Windows tests.

CI and head

Head 5d8ce56, PR open and not a draft, GitHub reports MERGEABLE and mergeStateStatus UNSTABLE. At fetch time changes and dependencies succeeded, verify was queued, and web, windows-cli and acp-registry were skipped. I did not wait for verify.

Cross-PR

Main moved from b15bc92 to 3d5749c (#1920, .github/workflows/ci.yml, README.md, docs/release/README.md). The PR does not touch those files and the merge tree is clean. Open non-draft PRs that touch the same files: #1902 (agents.rs, lib.rs, generated app-server services, catalog.md, npm/plugin.d.ts), #1917 (agents.rs, catalog.rs, timeline.rs, catalog.md, npm/plugin.d.ts), #1941 (face.rs, metadata.rs, sqlite.rs, timeline_store_face.rs, session-title code, plugin docs and npm types), #1921 (one test file). #1902 and #1917 both edit the generated catalog, so the later merge must regenerate it; #1941 touches the same storage files and will need a rebase.

Comment thread docs/design/plugins/SessionTitle.md Resolved
@eric8810
eric8810 requested a review from yyhhyyyyyy November 20, 2026 11:06

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

This PR finishes the SessionStore persistence split in docs/design/contracts/resource-owner-operations.md: callers use the Session store and timelineStore; repository, file-sweep, title and Timeline operations are bound on sqliteStorage; sessionStore, sessionMetadata and worktreeAssociations are removed. I reviewed the full origin/main...HEAD diff at ba8c43a, not only the two new commits. Merge base is b15bc92; current origin/main is 2537795, and the merge tree is clean (62190c6e).

The new commits fix every prior blocker and the one-sided creation exclusion. Moving the creation lock into SqliteStorage::create_session also breaks the storage shutdown contract and a pre-existing test in storage_flow.

Prior findings

  • P2 generated catalog stale: fixed in 5d8ce56, withdrawn.
  • P2 title contract says read: fixed in a710ddf. Appendix G and its zh mirror now say Store::read_metadata and async fn read_metadata (docs/design/plugins/SessionTitle.md:506,514; docs/zh/design/plugins/SessionTitle.md:436,443). Withdrawn.
  • P3 createSession missing from the callback exclusion lists: fixed in ba8c43a. The lock is now inside SqliteStorage::create_session (crates/dim-app-server/src/storage/timeline.rs:711), so the timelineStore and sqliteStorage routes share it, and both lists name createSession (npm/plugin.d.ts:694; docs/design/resource-faces.md:771). Withdrawn.
  • P3 raw fork and create checks: fixed in ba8c43a. SqliteStorage::fork_session checks both ids before the lock (crates/dim-app-server/src/storage/timeline.rs:3746-3748), and create_owned_session checks the id, takes the lock and repeats the cwd check (timeline.rs:3822-3833). Withdrawn.
  • P3 raw releaseSession/rollbackSession drain and raw setTitle notice: withdrawn. a710ddf drops all three from their Pick and declares them as raw SQLite steps with the precondition documented (npm/plugin.d.ts:624-629). The SDK no longer inherits contract promises that the raw methods do not keep.
  • P3 zh title doc line 3: fixed in a710ddf. The contradictory sentence is gone (docs/zh/design/appserver/session-title-metadata.md:1-3). Withdrawn.
  • P3 stale service references: not fixed, kept as the optional finding below.

Blocking finding

P2: createSession takes the ownership lock before it checks whether storage is closed

Problem. a710ddf moved the lock into SqliteStorage::create_session and placed it before self.run (crates/dim-app-server/src/storage/timeline.rs:711). run is where admit rejects a closed store (crates/dim-app-server/src/storage/sqlite.rs:1908-1926,1962-1968). A creation future that is queued on the blocking pool keeps the ownership guard for that whole wait, so a later createSession through the timelineStore binding pends on line 711 and never reaches the closed check.

Failure scenario. The pre-existing test sqlite_shutdown_drains_cancelled_and_queued_operations_before_releasing_ownership uses one blocking thread. The accepted creation is polled once and holds ownership while its run waits for that thread; then db.close() sets admission.closed. The test polls late = store.create_session("late", &config) and expects Err(AgentError::Storage(_)) (crates/dim-app-server/tests/storage_flow.rs:5346-5365). At this head late is Pending on the ownership lock, so the test fails deterministically. In production, a createSession that arrives during shutdown while an earlier creation, fork or worktree removal holds the mutex hangs until that holder finishes instead of failing with the documented storage code.

Evidence. crates/dim-app-server/src/storage/timeline.rs:711; crates/dim-app-server/src/storage/sqlite.rs:1908-1926,1962-1968,2081-2083; crates/dim-app-server/tests/storage_flow.rs:5325-5365. At 5d8ce56 the same suite recorded 172 passed and 1 ignored, and create_session took no lock there. The required verify job runs this suite (.github/workflows/ci.yml:195-201).

Fix. Check the closed admission before taking the lock. For example, add a SqliteStorage::ensure_open() that returns the same storage("SQLite storage is closed") as admit and call it on the line before this lock. The lock can stay for the open case; close() never takes it, so serialization and the fast refusal are both kept.

Optional finding

P3: four service references still describe the removed sessionMetadata and worktreeAssociations

Problem. The PR removes both services and the generated catalog no longer lists them, but these lines still present them as current or as future cleanup work:

  • docs/design/resource-faces.md:793 says to retire the catalog entries when their callers migrate.
  • docs/design/service-faces.md:325 says to remove worktreeAssociations when its callers migrate.
  • docs/design/appserver/session-deletion-and-fork.md:849 and docs/zh/design/appserver/session-deletion-and-fork.md:539 say SessionStore provides the process service worktreeAssociations.

Failure scenario. A reader who follows these documents looks for a service that the catalog and the code no longer provide; a Chinese reader learns that SessionStore still provides worktreeAssociations, which is false at this head.

Evidence. The lines above; docs/architecture/rust-agent/generated/catalog.md has no sessionMetadata or worktreeAssociations row; the service declarations are current and xtask check passes.

Fix. Delete the two retirement sentences and rewrite the two worktree-association paragraphs to name store.associateWorktree. The resource-faces.md line is in a file this PR already edits.

What holds at ba8c43a

  • The ownership mutex is shared by the store face, the raw dispatcher and the timelineStore binding. No in-tree path takes it twice: the store methods delegate without locking, the raw RemoveWorktreeDirectory arm locks before the non-locking row step, and delete_session locks before rollback_session. Lock order is always ownership then the connection admission; no path reverses it.
  • The check move preserves behavior on native and dispatched calls. Fork checks both ids before copying, create-owned checks the id and cwd before writing, and both report invalid through face::failure; the raw fixture now asserts the same refusals through sqliteStorage.
  • The new Node case polls a timelineStore creation during a removal callback and expects it to wait, covering the shared exclusion (crates/dim-app-server/tests/transport_flow/process_typescript.rs:1781-1787).
  • Appendix G, its zh mirror, the generated catalog, the service declarations and the npm types are consistent at this head, and cargo run --locked -p xtask -- check passes.

Verification

Isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR under the data directory, LC_ALL=en_US.UTF-8, worktree clean and detached at ba8c43a.

  • git diff --check origin/main...HEAD: pass.
  • cargo fmt --all -- --check: pass.
  • cargo run --locked -p xtask -- check: pass (742 modules, 4558 edges, crate and module boundaries, 26 plugin documents, service catalog, service declarations, plugin locks, 97 comment links, literal main).
  • cargo test -p dim-app-server --test storage_flow: 171 passed, 1 failed, 1 ignored. The failure is the P2 above.
  • cargo test -p dim-app-server --test storage_session_flow: 3 passed.
  • cargo test -p dim-app-server --test transport_flow: 585 passed, 0 failed, 98 ignored.
  • cargo test -p dim-app-server --lib --features testing: 125 passed.
  • git merge-tree --write-tree origin/main HEAD against origin/main 2537795: clean (62190c6e). GitHub reports MERGEABLE with mergeStateStatus UNSTABLE.

Unverified

  • Node-gated cases did not run locally because runtime/node_modules is absent: the new late timeline creation, the two new raw invalid-id operations, the ignored title flow and the 98 ignored transport cases rest on CI.
  • I did not run Clippy, the full workspace suite, or Windows tests.

CI and head

Head ba8c43a, PR open and not a draft. At fetch time changes and dependencies succeeded, verify was queued, and web, windows-cli and acp-registry were skipped. The storage_flow failure above is in a suite that verify runs, so verify is expected to fail. I did not wait for it.

Cross-PR

Main moved from 3d5749c to 2537795 (17 TUI, web and CLI commits, no overlapping files); GitHub reports the PR mergeable. Open non-draft PRs that touch the same files: #1902 (agents.rs, lib.rs, generated app-server services, catalog.md, npm/plugin.d.ts), #1917 (agents.rs, catalog.rs, timeline.rs, catalog.md, npm/plugin.d.ts), #1941 (face.rs, metadata.rs, sqlite.rs, timeline_store_face.rs, session-title code, plugin docs and npm types, plus process_typescript.rs), #1921 (one test file). #1902 and #1917 both edit the generated catalog, so the later merge must regenerate it; #1941 touches the same storage files and the same transport test, so it will need a rebase.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Store and SQLite repository error mappings now agree, and the ordinary call paths share the ownership mutex. One consistency issue remains from static inspection. The admitted persistence task needs to retain the ownership guard through commit or rollback even if its caller stops awaiting the result.

For this head, GitHub changes and dependencies passed and macOS verify is queued. CI

…rage

# Conflicts:
#	crates/dim-app-server/src/storage/face.rs
#	crates/dim-app-server/src/storage/metadata.rs
#	npm/branch-services.d.ts

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

This PR finishes the SessionStore persistence split: callers use the Session store and timelineStore, repository, file-sweep, title and Timeline operations are bound on sqliteStorage, and the sessionStore, sessionMetadata and worktreeAssociations faces are removed. I reviewed the full origin/main...HEAD diff at 062de2c, the merge of c208a39 with main ffd3e11 (42 files, 1766 additions, 1405 deletions).

Prior findings

  • The P2 from 5991847356 is fixed. run_ownership_write admits before it waits for ownership, takes the guard inside the spawned task and moves it into the blocking write through commit (crates/dim-app-server/src/storage/sqlite.rs:1935,1940-1952), so a creation after close is refused with storage instead of pending on the mutex. The pre-existing test passes (crates/dim-app-server/tests/storage_flow.rs:5325).
  • zerob13's ownership-lifetime finding is fixed at this head. Fork, owned creation and association move the guard into the run/run_copy closure (crates/dim-app-server/src/storage/timeline.rs:3747,3817,3888), and the raw removeWorktreeDirectory arm takes it exactly once around the non-locking row step (crates/dim-app-server/src/storage/sqlite.rs:2981).
  • Every other thread stays fixed or withdrawn. No old finding remains open.

Merge resolution

The merge kept the new ownership and admission code and adopted main's rutis 0.23 error spelling. Error::value is used in face.rs and metadata.rs and BridgeError::value in sqlite.rs; no Error::Value remains anywhere in the tree. face.rs keeps the AssociateWorktree detection and its association_failure mapping (crates/dim-app-server/src/storage/face.rs:468,527-536). metadata.rs keeps Store::readMetadata, Store::setTitle and title_operation while using main's constructor. npm/branch-services.d.ts is main's file minus WorktreeAssociations, WorktreeAssociationError and the Services.worktreeAssociations entry, with main's interface to type conversions intact. No worktreeAssociations or sessionMetadata name remains in code, npm types or generated output. Files both sides touched keep both changes: main's 16 MiB case in process_typescript.rs, main's rutis 0.23 text in single-tree.md and typescript-plugin-authoring.md. git merge-tree --write-tree origin/main HEAD equals HEAD's tree (a172fd3d), and git diff --check origin/main...HEAD is clean.

Ownership contract at this head

  • createSession admits first (sqlite.rs:1935,1988), then the spawned task takes ownership and holds it through the blocking write and commit. close only sets closed and drains the admitted count; it never takes ownership (sqlite.rs:2107-2162).
  • Fork, owned creation and association take the guard once and move it into the blocking closure, so a dropped caller cannot release it before commit (timeline.rs:3747,3817,3888). Directory removal and deletion take it once and call the non-locking row steps (timeline.rs:1466,1567,1583; sqlite.rs:2981). No path takes it twice, and reads do not take it.
  • The refusal order is correct for the path the shutdown test covers: an admitted creation after close fails at admit before any ownership wait. The other ownership operations take ownership before admit; that wait is bounded by the admitted writers draining, not a deadlock.

Verification

  • cargo fmt --all -- --check: pass.
  • cargo run --locked -p xtask -- check: pass (742 modules, 4560 edges, service catalog, service declarations, plugin locks, comment links, literal main).
  • cargo test -p dim-app-server --test storage_flow: 172 passed, 0 failed, 1 ignored. sqlite_shutdown_drains_cancelled_and_queued_operations_before_releasing_ownership (storage_flow.rs:5325) passes.
  • cargo test -p dim-app-server --test storage_session_flow: 3 passed.
  • cargo test -p dim-app-server --test transport_flow: 585 passed, 0 failed, 98 ignored. A first run had two timing failures while the data filesystem was 100 percent full; after freeing build artifacts the same suite passed with no code change.
  • cargo test -p dim-agent-capabilities --test permission_flow --test legacy_session_faces: 34 and 4 passed.
  • cargo test -p dim-session-title: all suites pass.
  • cargo test -p dim-app-server --lib --features testing: 125 passed.

Optional P3, not blocking

The service rename still has stale references outside the changed hunks:

  • docs/design/resource-faces.md:793 says to retire the catalog entries sessionMetadata and worktreeAssociations when their callers migrate; both entries are already gone, so a reader looks for a retirement step with nothing left to retire.
  • docs/design/service-faces.md:325 says to remove worktreeAssociations when migrating callers; it is already removed.
  • docs/design/appserver/session-deletion-and-fork.md:849 and docs/zh/design/appserver/session-deletion-and-fork.md:539 say SessionStore provides the process service worktreeAssociations; FileAccess now calls store.associateWorktree, so the Chinese document teaches a service that does not exist.
  • docs/design/plugins/Tui.md:601 lists sessionMetadata among the names the leaf's session carries today; the catalog now has store instead, so an audit of the leaf's exported names reads a stale list.

The title structure diagrams still label the read as read while the dispatcher accepts only readMetadata (docs/design/appserver/session-title-metadata.md:44; docs/zh/design/appserver/session-title-metadata.md:27; crates/dim-app-server/src/storage/face.rs:378,383). A plugin author who copies the diagram calls an unknown method and the title read fails. The normative table and Appendix G already say readMetadata and Store::read_metadata, so this is a wording fix.

Unverified

  • Node-gated cases did not run locally because runtime/node_modules is absent: the new late timeline creation and raw invalid-id cases, storefixture.release_timeline, the ignored title flow and the 98 ignored transport cases rest on CI.
  • Clippy, the full workspace suite, Windows and macOS-native checks did not run here.

CI and cross-PR

At 062de2c the PR is open, not a draft, and GitHub reports it mergeable with mergeStateStatus UNSTABLE. changes and dependencies passed, verify (linux) is in progress, macos-native is queued, and web, windows-cli and acp-registry were skipped. I did not wait.

Open non-draft PRs that touch the same files: #1917 (catalog.rs, timeline.rs, npm/plugin.d.ts), #1910 (npm/branch-services.d.ts, npm/plugin.d.ts), #1913 and #1902 (npm/plugin.d.ts). #1917 and #1910 will need to regenerate the generated catalog and service declarations after this merges.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

This PR finishes the SessionStore persistence split: callers use the Session store and timelineStore, repository, file, title and Timeline operations are bound on sqliteStorage, and the sessionStore, sessionMetadata and worktreeAssociations faces are removed. I reviewed the full origin/main...HEAD diff at a507205 and compared it with the head approved at 062de2c.

Delta since 062de2c

a507205 has one parent, 062de2c, and changes two lines: the structure diagrams at docs/design/appserver/session-title-metadata.md:44 and docs/zh/design/appserver/session-title-metadata.md:27. With those two files excluded, git diff 062de2c8 a5072054 is empty, so every other file is byte-identical to the approved head.

Both diagrams now read readMetadata -> read_metadata(). That matches the dispatcher, which lists and accepts readMetadata (crates/dim-app-server/src/storage/face.rs:378,383), the section 4.1 table (docs/design/appserver/session-title-metadata.md:90; docs/zh/design/appserver/session-title-metadata.md:68) and Appendix G (Store::read_metadata and async fn read_metadata, docs/design/plugins/SessionTitle.md:506,514; docs/zh/design/plugins/SessionTitle.md:436,443). Both diagram rows stay 88 columns wide and the +, | and v connectors remain at column 88, so the rest of the drawing did not move.

Prior findings

  • The remaining P3 note in thread 4641278468 is fixed at a507205; replied.
  • Every other thread stays fixed or withdrawn. No old thread is open.
  • The four stale-reference notes listed in the previous review body (docs/design/resource-faces.md:793, docs/design/service-faces.md:325, docs/design/appserver/session-deletion-and-fork.md:849 with docs/zh/design/appserver/session-deletion-and-fork.md:539, and docs/design/plugins/Tui.md:601) are outside the changed hunks and unchanged at this head. They stay optional P3 and do not block.

Verification

  • git merge-tree --write-tree origin/main HEAD: clean; the result tree 1a4ebbb2 equals HEAD's tree.
  • git diff --check origin/main...HEAD: clean.
  • cargo fmt --all -- --check: pass.
  • cargo run --locked -p xtask -- check: pass (742 modules, 4560 edges, service catalog, service declarations, plugin locks, comment links, literal main).
  • Code and generated files are unchanged from the approved head, so the targeted test results reported at 062de2c carry over.

CI and cross-PR

At a507205 the PR is open, not a draft, and GitHub reports MERGEABLE with mergeStateStatus UNSTABLE. changes, dependencies and macos-native passed; verify (linux) is queued; web, windows-cli and acp-registry were skipped. I did not wait.

Open non-draft PRs that touch the same files: #1917 (catalog.rs, timeline.rs, npm/plugin.d.ts), #1910 (npm/branch-services.d.ts, npm/plugin.d.ts), #1913 and #1902 (npm/plugin.d.ts). #1917 and #1910 will need to regenerate the generated catalog and service declarations after this merges.

@eric8810

Copy link
Copy Markdown
Collaborator Author

未完成所有者调查就开始的改动,关闭。后续按 #2015 的扫描结论重新设计,对应 #2018。分支保留,供重新设计时参考。

@eric8810 eric8810 closed this Nov 23, 2026
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.

4 participants