Commit Graph
731 Commits
Author SHA1 Message Date
unsc9 26be90d66f test(e2e): composer 定位改用宿主的 composer slot
首屏占位符名字(Describe what you want to build)在会话有内容后就消失了,
拿它查 composer 会一直超时。改锚定 [data-slot=conversation.composer.bar]:
这是宿主自己的稳定属性,且天然把插件里同样 contenteditable 的 CodeMirror
排除在外,不用再靠 DOM 顺序猜。
2026-10-24 20:50:07 +08:00
unsc9 9067e2cac4 test: 夹具跟上 insertReference facade,e2e 复用权威 composer 定位器
- conversation-draft 的两份 composer 假件合成一个 composerCtx,删掉从未
  被调用或断言的成员(setDraft / snapshot / phase 选项)。
- reference-in-chat、sidebar-workspace-reference 改为断言 facade 调用,
  不再断言 emit 事件。
- mount.e2e 用 host.ts 导出的 composerLocator,不再用
  [contenteditable=true].first() —— 插件自己的 CodeMirror 也是
  contenteditable,按 DOM 顺序取首个会取错。
- 修正设计文档里一条与实现相反的结论(ref 存的是发送正文,不是 label)。
2026-10-24 20:29:59 +08:00
unsc9 1ed872268c test(e2e): 选区气泡探针改用真实拖拽与正确的选择器
三击/合成点击会在 mouseup 之前丢掉选区,浮层不弹;改用 mouse.move/down/up
的真实拖拽。气泡是 composer 里的兄弟装饰节点,不是 role=textbox 的后代,
选择器改按 label 文本在整页范围内定位。

真机 mount lane 已验证通过(23s):预览里选中一行 → 点按钮 → composer
里出现 diagram.md:12 气泡,草稿不含三反引号。
2026-10-24 19:39:55 +08:00
unsc9 8c431db740 test(e2e): 断言选区引用落在 composer 里是气泡,不是围栏正文
真机 mount lane 加一段:预览里选中一行 → 点「添加到对话」→ 断言
composer 里出现 path:lines 气泡,且草稿文本不含三反引号。
宿主若不认 reference-insert 事件、退化成纯文本,这条会直接失败。

同时记录设计与两套坐标系(clipboard / detect)的折算规则。
2026-10-24 19:17:42 +08:00
unsc9 f71a2727f1 feat(editor): 选区引用改成气泡,正文只在发送时展开
选中文字后点「添加到对话」,草稿里插入的不再是一整段围栏正文,而是
一个紧凑气泡(显示 `相对路径:起止行`);发给模型的仍是完整围栏块。
连续引用几段不再把输入框铺满。

- 复用宿主自己的 slash/input-insert-reference 通道(原生 @ 选择器同款)
- 新增 foldClipboardOffset:把草稿偏移折算到宿主的 detect 投影,否则
  草稿里已有气泡时 span 越界、第二次插入必然失败
- 气泡的 clipboardText 取短形态(label),会话重挂载时退化也只是一行
- 宿主没有气泡通道时回退原来的纯文本路径
- appendToDraft 在已有气泡的草稿上改走 span 事件,避免 setDraft 重建
  文档把每个气泡碾平
2026-10-24 19:09:07 +08:00
Menghuan1918 18dade0f63 fix(perf): address the perf-scan review findings 2026-10-24 12:10:17 +08:00
Menghuan1918 a721911d44 perf(worktree): re-arm the active-root TTL when the event cursor is idle 2026-10-24 02:17:12 +08:00
Menghuan1918 81b2e8077e perf(bundle): answer HEAD from the stat without reading the chunk 2026-10-24 02:17:12 +08:00
Menghuan1918 0a4a94c704 perf(graph): window the commit history rows 2026-10-24 02:17:10 +08:00
Menghuan1918 2237f3787b perf(diff): parse a patch once and cap the default expansion 2026-10-24 02:17:10 +08:00
Menghuan1918 b1efd9226b perf(sidechat): cache the per-row prose rewrite 2026-10-24 02:17:07 +08:00
Menghuan1918 4cb7937a37 perf(files): keep parked trees idle and batch the watcher re-arm 2026-10-24 02:17:07 +08:00
Menghuan1918 27a920f85b perf(tasks): coalesce wheel zooms to one commit per frame 2026-10-24 02:17:05 +08:00
Atlas Zeng 740d73a09a Merge pull request #1041 from omdsh-dev/fix/tasks-folding-performance 2026-10-23 21:44:37 +08:00
Menghuan1918 dc385130a0 fix(tasks): coalesce pointer drags to one update per frame
Background pans, the floating-window title drag and the anchored-popover drag committed on every pointermove, so a high-report-rate mouse re-rendered the tasks canvas at event cadence. Compose the latest position in a ref and commit it through the existing frame batcher; release and cancel flush synchronously. Click suppression still updates per event.

Regression: same-frame 100-move burst commits drop 98 -> 1; full suite 2720 passed.
2026-10-23 21:28:22 +08:00
NolanHo 6f14792baa fix(sidechat): address rendering review findings
Replace a failed present card with the generic failed tool row; keep one event-authoritative card whichever of the call and its delivered event lands first.

Use the host's real border token for the delivery card; include the visible description in the file button's accessible name and resolve its title path.

Handle CommonMark angle-delimited image destinations and preserve titles; add transcript, prose-rewrite, and DOM regression tests.

Update the change spec with review-driven acceptance commands, status, and evidence.
2026-10-23 02:48:13 -07:00
NolanHo 909f536eab feat(sidechat): render local images and present deliveries
Cache markdown label objects by value so MarkdownText's memo survives parent re-renders; pass streaming for unsettled assistant rows.

Rewrite local image destinations in Side Chat prose against the session cwd through the existing /sidebar/file media route.

Map present tool calls and deliverables/presented events to a compact delivery card with thumbnails and the plugin's file-open path.

Add the change spec, exploration notes, and regression tests.
2026-10-22 22:25:07 -07:00
Menghuan1918 787d873a8c fix(tasks): restore graph expansion and configurable branch folding
Reset per-gesture travel before node guards so a preceding background pan cannot suppress the next card click. Index and iteratively lay out graph topology, memoize agent card contents, and project complete settled branches under independent existing-settings preferences.

Keep unknown real workflow catalogs and explicitly opened descendant paths visible. Add regression coverage and real rc.1 browser/baseline validation evidence.
2026-10-23 12:38:23 +08:00
NolanHo e5f96b8e36 fix(sidechat): trim the seed when a model switch rewrites the head
A model switch after the last compaction replaces the protected system
prompt with a system/message whose seq sits after the cut but whose
surface slot is the head before the checkpoint. The builder refused that
shape, so every such sidechat copied the parent log in full.

Resolve the single-node replacement chain to its pre-cut anchor using the
checkpoint's recorded shadowed set (not its declared numeric range, which
misclassifies keep-window replacements), carry the latest replacement in
the head slot with the anchor's turn/step scaffolding, and consume the
chain so the keep window and tail never re-emit it. Range replacements,
targets the checkpoint removed, non-system nodes, and broken or forward
chains still fall back to the verbatim copy.

Tests cover a single switch, a two-switch chain, a multi-hop chain whose
intermediate sits inside the declared range but not in the shadowed set,
and a valid range fallback. The trim fixtures fall back on the old code.
Real parent logs now trim (6036->187, 8329->2479, 16458->4359, ...) with
surface equivalence and Session.create acceptance; the previous
35992->3456 trim is unchanged.
2026-10-19 07:37:01 -07:00
Menghuan1918 66c91091bc chore(release): adapt to DSH 0.2.1-rc.1 for 0.28.0 2026-10-17 14:03:22 +08:00
Menghuan1918 1fd6e0f139 test: accept CRLF checkouts in DSH baseline guard 2026-10-17 12:15:58 +08:00
Menghuan1918 2b8a4da569 chore(release): prepare alpha.0 with latest dev fixes 2026-10-17 12:02:59 +08:00
Menghuan1918 6417547bb5 merge origin/dev: include Context diagnostics and graph layout fixes
# Conflicts:
#	CHANGELOG.md
2026-10-17 11:52:48 +08:00
Menghuan1918 38d94bdb98 fix(git): let commit graph fill available sidebar height
Replace the 460px viewport cap with flex allocation. Bound the graph section minimum so long history scrolls internally instead of stretching the outer list. Verify tall and narrow panes, preview selection, folding and long Changes lists in the mounted host.
2026-10-17 11:33:55 +08:00
Menghuan1918 93c43b0ac9 feat: add optional Context diagnostics navigation
Use an activation-scoped Cordis controller for session, agent, and job-owner entries. Reuse native Context tabs, cancel stale navigation, and close source overlays without canceling pending requests.

Verify optional capability lifecycle, truthful job ownership, three real dsh-context configurations, and the existing mount regression suite.
2026-10-17 02:20:53 +08:00
Menghuan1918 4ebd3e9bdd chore: adapt sidebar to DSH 0.2.1-alpha.5 2026-10-17 02:12:44 +08:00
Menghuan1918 3e9eacf0cb test(e2e): isolate scroll retention fixtures per run 2026-10-16 21:49:48 +08:00
Menghuan1918 0ba7edf444 fix(git): keep selected change rows inside their groups
Restore selection declarations removed with logRow during graph integration. Dangling selectors had inherited absolute positioning and borders from indent guides. Add parsed CSS and mounted browser regression coverage for staged, unstaged and conflict rows.
2026-10-16 21:45:57 +08:00
Menghuan1918 e523f832cc merge pr-964 (#964 侧边对话子会话改为从最后一次 summarizing compaction 起种,不再全量复制父日志) into dev(@NolanHo) 2026-10-16 21:27:48 +08:00
Menghuan1918 88ded478de merge pr-969 (#969 feat(git-graph): 只读提交图) into dev(@vlln)
融合(D5):#969 的图谱引擎作为 Git 镜头内的「提交图」区上线,不再新增第三个镜头。
- 保留:src/git-graph.ts(有界路由 + graph-stale/graph-limit)、graph-layout.ts、
  graph.module.css、CommitDetails、DiffPane 的 PaneTabStrip 与 details/content/diff 分签、
  hover 卡片、引用徽章、分支筛选、无限滚动、e2e 与设计文档;
- 落位:GitGraphLens → GitGraphSection(挂在 GitLens 的 Graph 区,目标读镜头自己的
  仓库/worktree 选择,不再自持选择器);行右键接回 #944 的提交菜单(查看/复制/revert/cherry-pick);
- 去掉:第三镜头与 changesGraphLens 键、#944 的 GitGraph.tsx(及随之无消费者的
  log 行样式与 historyLoadError/changesNoHistory 词典键);
- 镜头常驻保留(hidden 切换):Graph 的滚动/选中、Changes 的展开与草稿切走不丢,
  同时 store 槽位与轮询按「可见 + 在屏」分别门控(切回不闪 loading);
- 两套重写过的测试按新契约对齐(底部面板分签、图谱区与 Git 镜头的关系、图行/历史断言)。
2026-10-16 17:30:44 +08:00
Menghuan1918 40ed740f3a merge pr-944 (#944 feat(git): Git 内容区改为 VS Code Source Control 结构) into dev(@hairyf)
冲突解决(按 D4 与仓库现役不变量):
- status() 改为 porcelain v2(branch/upstream/ahead-behind/detached/operation 一次读回),
  但保留 dev 的行/字段上限、pathspec 化 numstat 与 #909 的分侧计数;v2 记录遍历抽成
  porcelainV2Tokens,状态解析与 pathspec 提取共用同一份字段知识;
- GitLens 的 Merge/Staged/Changes 三组取 #944,两组各读自己那一侧(#909),
  Merge 组不印行数(冲突不是行数故事,也不许把某一侧当「这个数」);
  sideEntries 保留(每组只读自己那一半的 XY 字母);
- ChangesTab 保留 #939 的官方 Tabs 外观与 a11y 包装、刷新按 #944 只留给本轮文件镜头;
- 测试:git.spec 导入取并集、rmSync 清理改回 removeTree、smoke 的 branch/detached 断言
  按 porcelain v2 语义改写,其余用例按新契约微调(band 顺序、changesOps 第 4 参 wait)。

剔除夹带(D4):.agents/skills/handle/SKILL.md、eslint/vitest 的 soruce/vscode 忽略项、
webRuntime→connection.requestRejection 栅栏与 ownEntryId 放宽(index.ts / context-types.ts
取 dev)、栅栏类测试桩与注释一并回退,栅栏归属留给 0.2.1 兼容批。
2026-10-16 17:14:06 +08:00
Menghuan1918 6586c08bbc test(changes-ops): 对齐空窗长轮询的契约断言(#885 收尾)
- tests/unbounded-caches.spec.ts:基线拉取不再传 0 而是不传游标(0 会丢掉 seq 0 的真实事件),
  并断言 primed 之后第 4 参 wait=true、基线 false;
- tests/changes-ops-route.spec.ts:用例名/注释英文,补一条 PTC 事件对穿透路由的断言,subCallId 用 ToolCallId;
- api.ts / ChangesTab.tsx / ops-stream.ts 的说明改回英文行文(行为不变)。
2026-10-16 16:54:41 +08:00
Menghuan1918 bd65b41e9d merge pr-885 (#885 fix: 减少 changes.ops 空窗重复请求) into dev(@wang-kaopu)
冲突解决:保留 #885 的路由抽取(src/changes-ops.ts + 'changes.ops': changesOps),
把 dev 的现役内容搬进新模块:PTC 四种事件类型、-1 游标下限、会话/持久化双读与 4000 窗口;
index.ts 的 import 块取 dev(只补 ServerResponse),订阅回调按仓内惯例restate 最小结构切片。
测试:路由 spec 加一条 PTC 事件穿透断言,用例名与注释统一英文。
2026-10-16 16:44:20 +08:00
Menghuan1918 db2a87f360 merge pr-921 (#921 fix: 修复 PTC 模式下本轮文件列表为空) into dev(@wang-kaopu)
冲突解决:extractFileOps 的文档注释与实现合并「PTC 事件对 + 会话 cwd 路径解析」两半,
参数解析抽成 ptcArgs(PTC 的 arguments 已是对象);测试保留 PTC 四例并按 #940 去掉分组名。
host 路由 / ops-stream 头注释恢复英文行文(行为不变),README_EN.md 保持删除、README.md 取 dev。
2026-10-16 16:41:11 +08:00
Menghuan1918 bb23b47fa5 merge pr-886 (#886 fix(changes): 本轮文件按会话 cwd 解析完整路径) into dev(@wang-kaopu)
冲突解决:README.md 取 dev、README_EN.md 保持删除、CHANGELOG 里误落 v0.25.0 段的条目删掉(发版段统一在收尾批处理);
#886 的用例去掉 groupByFile(#940 已删除该分组函数),改断言解析后的完整路径。
2026-10-16 16:39:50 +08:00
Menghuan1918 9f630d1618 merge pr-940 (#940 fix(changes): 本轮文件操作改为平铺行) into dev(@hairyf)
冲突解决:README.md 取 dev(PR 基于拆分前的旧中英双 README,改动目标已不存在),
README_EN.md 保持删除;guide 的 usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]
           [--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>]
           [--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone      Clone a repository into a new directory
   init       Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add        Add file contents to the index
   mv         Move or rename a file, a directory, or a symlink
   restore    Restore working tree files
   rm         Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect     Use binary search to find the commit that introduced a bug
   diff       Show changes between commits, commit and working tree, etc
   grep       Print lines matching a pattern
   log        Show commit logs
   show       Show various types of objects
   status     Show the working tree status

grow, mark and tweak your common history
   backfill   Download missing objects in a partial clone
   branch     List, create, or delete branches
   commit     Record changes to the repository
   history    EXPERIMENTAL: Rewrite history
   merge      Join two or more development histories together
   rebase     Reapply commits on top of another base tip
   reset      Set `HEAD` or the index to a known state
   switch     Switch branches
   tag        Create, list, delete or verify tags

collaborate (see also: git help workflows)
   fetch      Download objects and refs from another repository
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system. 行合并「平铺措辞 + 下划线 Tabs 说明」;
editor-host.spec.tsx 的 RENDER_WAIT_MS 注释保留 dev 的 CI 史,并补记 PR 的夹具泄漏结论。
2026-10-16 16:38:37 +08:00
Menghuan1918 5b6f7319f9 merge pr-909 (#909 fix(changes): 变更面板两侧行数不再相加,各分组各读自己那一侧) into dev(@UNscientific-9)
冲突解决:删除 addLineCounts,状态读数改为分侧(staged/unstaged 各自一张表),
保留 dev 的 pathspec 化 numstat 读取(--literal-pathspecs + 原路径 + 行/字段上限)。
同批带上 #607 落地后暴露的两处适配:
- discoverRepoRoots 的 BFS 发现根改走 realpath(macOS tmpdir 的 /var → /private/var 别名,
  否则 rev-parse 的根与扫描根是同一仓库的两种拼法,dev 的 canonical() 断言当场红);
- tests/git-worktree 的 numstat pathspec 用例按分侧形状断言(合计仍为 +3/−0)。
2026-10-16 16:35:59 +08:00
Menghuan1918 15665f1ff3 merge pr-607 (#607 feat(git): 工作区根为仓库时仍探测并展示子目录独立仓库) into dev(@iasiv5) 2026-10-16 16:33:40 +08:00
Menghuan1918 f132c69cb0 merge pr-827 (#827 fix(git): 自动应答 dubious ownership 守卫,单命令注入 safe.directory) into dev(@yanzhaohui1999)
冲突解决:保留 dev 的 runGit 三道护栏(8 MiB 输出上限 / maxNulFields 行数上限 / core.quotePath=false),
把 #827 的 spawnGit + safe.directory 重试叠在其上;GIT_ENV 取并集(GIT_OPTIONAL_LOCKS=0 + LC_ALL=C)。
不复活已被 ebc5d0b6 删除的 runGitRaw(无调用者)。
2026-10-16 16:33:38 +08:00
Menghuan1918 1de5e44394 merge pr-939 (#939 fix(changes): 镜头切换器改用官方 Tabs 样式) into dev(@hairyf) 2026-10-16 16:31:17 +08:00
NolanHo 37e0354d15 fix(sidechat): drop a command/done whose citation fell in the dropped span (round 5, F2)
The round-5 final report pinned a real bad-seed path on cc11ce4 and
verified my in-flight atomic drops did not cover it: a command/done
whose run SURVIVES while its numeric sourceEventSeq cites an earlier
NON-command event in the dropped span kept the parent seq — a stale
citation the host's commands invariant rejects (the contract: the
citation names an earlier non-command event, never the run). Their
real-data oracle found three such seeds among the forty genuinely
trimming production sessions.

The pre-decision now drops the done when either its run's commandId or
its cited source seq is not in the emitted set (the run staying behind
is legal — an open command), and rebaseEvent's runtime belt returns
DROPPED for an unmappable citation instead of leaving the parent value.
The spec's both-kept fixture is rewritten against the host contract:
unique commandId per run and a citation pointing at the user message,
asserting the remapped citation names a non-command event. A mutation
that removes the droppedGroups filter reddens the mid-keep-group case,
so the atomic-drop chain and the bracket gate now have an in-repo pin.
2026-10-16 16:14:41 +08:00
NolanHo f320cdee83 fix(sidechat): drop grouped records atomically and honor the host's optional removedCount (round 5)
The round-5 delta review and the real-data re-run exposed two v5
regressions that disabled the optimization exactly where it matters.

First, the new bracket gate fell back on real multi-group sessions: a
mid-keep compaction group's summary cites nodes a later group
re-shadowed, so record-level dropping stranded its successful
compaction/end and the gate rejected the whole tail — the deployment's
main session forked at 9,077 ms with seed 35,993 (the full copy). The
fix is the reviewers' other option, now data-backed: decide the
emitted-seq set BEFORE emission and drop unmatched groups ATOMICALLY —
a compaction bracket goes as a whole, a command/done losing its run
goes alone. The fuzz suite recovers from 108 to 129 clean trims per
3000 cases (every one passing the real session, compaction, and
commands invariants plus the real inbox projection), and the round-4
cascade counterexample flips from fallback to a clean trim.

Second, v5 treated a missing removedCount as invalid, but the host
contract makes it optional and defaults it to 0 — the host's own writer
omits it for pure inserts, 54% of production splices are like that,
and 38 of 89 real compaction sessions (including the e2e main session)
fell back purely on this. Restored the ?? 0 default while keeping the
rest of the host-fold strictness.

The round-4 spec case is rewritten against the host's chained-replace
semantics (the consumed group swallows the surface span as it exists
at ITS fold moment), which turned it from an empty test — the fixture
could not fold at all, so it pinned nothing — into a real pin: the
atomic drop trims with the earlier group's records gone entirely.
Final second-instance e2e on the real main session: 953 ms, seed
3,457 (10.4x), and a cold-context answer that only the compaction
summaries could contain.
2026-10-16 16:14:41 +08:00
NolanHo a106e1964e fix(sidechat): keep grouped records atomic and pin them with host-oracle tests (review round 4)
Round 4 (two fresh reviewers, pinned to both 657dcd5 and 196fa11)
could not falsify the core equivalence (2100 generated shapes, 113
trims all passing the real session invariant, Session.create, the real
durable-inbox projection, and node-by-node deriveEventMessage wire
comparison; every non-trim byte-identical to the legacy full copy) but
both votes converged on one root cause: host GROUPED records were
split by record-level dropping. A kept compaction group could lose its
summary to the dropped span and strand a successful compaction/end the
host's compaction invariant companion rejects; a command/done could
outlive its command/run the commands companion rejects — invisible to
all three existing self-checks. The inbox fix from the e2e (196fa11)
was verified: the positional durable-inbox projection is the layer the
host rejects at, and the walk-back plus inboxSplicesValid hold.

v5: bracketsValid mirrors the host's grouped-record rules (a successful
compaction/end requires its compaction/summary; a command/done requires
its prior command/run) so a split group falls back to the full copy;
command/done.sourceEventSeq remaps onto the rebased run;
expectedFirstKeptTurn is derived from the skeleton's actual turn/start
(out-of-turn heads no longer renumber against a phantom turn 1); and
inboxSplicesValid matches the host fold's strictness (known targets,
numeric start/removedCount, array inserts, string ids). The spec's
oracle now uses the host's own deriveEventMessage so a projection bug
cannot hide from the equivalence cases, and two new cases pin the
round-4 shapes (same-turn double compaction, command bracket split and
its both-kept control with a remapped sourceEventSeq).
2026-10-16 16:14:41 +08:00
NolanHo b4e5c62f04 fix(sidechat): swallow the keep window's leading inbox inserts (real-data e2e catch)
The real loop order writes a turn's inbox INSERT before its turn/start
and the CLAIM right after it; starting the keep window at the turn/start
kept the claim while dropping its insert, and the host's positional
durable-inbox fold rejected the seed at Session.create — caught on the
deployment's real main session during the v4 e2e re-run (thread creation
failed: invalid persisted inbox splice at session seq 7).

The keep start now swallows the contiguous agent/inbox/spliced events
preceding the skeleton root (they replay cleanly from an empty inbox),
and a new inboxSplicesValid gate mirrors the host's fold — positional
splice application with duplicate-id rejection — so any splice history
that cannot replay falls back to the full copy instead of shipping a
seed the host rejects. Pinned by a spec case in the real loop order.
2026-10-16 16:14:41 +08:00
NolanHo 98c42971a2 fix(sidechat): normalize the head skeleton and mirror the host invariant core (review round 3)
Round 3 (two fresh reviewers) converged on: the head skeleton kept the
rewritten system head's ORIGINAL step number (a mid-session rewrite can
live at turn 1 step >= 2), the relational gate lacked the host's
nextStep/pendingCalls rules (a wide head's tool/result without its call
slipped through), kept compaction metering records carried stale
shadowedRange/shadowedSeqs (violating the compaction invariant
companion), and the gate was STRICTER than the host on non-append
tool/results — so the default-loaded pruner's replacements silently
disabled the trim.

v4: the head skeleton normalizes to turn 1 step 1, rewriting only the
envelope numbers an event already carries (a user/message never gains
fields — its whole data object IS the model-visible message; the
equivalence token now mirrors the renderer's projection exactly: user
messages compare their full data, everything else data.message). The
gate mirrors the host invariant's counter and pairing core: contiguous
turns, no nested open turn, sequential steps, in-turn naming with the
host's non-append tool/result exemption, and pending-call consumption.
Compaction metering records rebase their citations; when the span they
priced did not survive, the record is dropped. A surface node that is a
kept replacement's fold TARGET is no longer skipped, so pruner
replacements replay their transition instead of degrading into an
append stranded after a closed step — that shape now trims.

Pinned by new spec cases (rewritten head, pruner-rewritten keep-window
result) and by all three review rounds' out-of-tree probes.
2026-10-16 16:14:41 +08:00
NolanHo 0f9772a0d9 fix(sidechat): renumber turns over the dropped gap and keep mid-span regions (review round 2)
Two fresh reviews converged on a new blocking: the v2 head skeleton
closes turn 1 while the keep window keeps its original turn/start{N},
so the seed's turn counter jumps (1, N) — both of the branch's own
self-checks (foldSurface equivalence, Session.create) miss it, but the
host's relational invariant throws InvariantError in sessions.create on
every host that loads the invariant companion. The spec's invariant case
passed only because its fixture put the keep window at turn 2 — the one
continuous shape.

Also from the same round: the host's compaction region boundary is only
tool-pairing balanced, so it can end mid-turn — the keep interval then
re-emits the shadowed early nodes of its first turn and the verification
fell back (measured: only turn-aligned cut points ever trimmed).

v3: renumber data.turn over the gap (first kept turn/start scanned in
the keep interval AND the tail, since a head-only survivor set leaves
the keep interval empty); skip shadowed surface events and orphaned
tool/calls inside the keep interval; gate the result with
turnSequenceValid — turn counters contiguous, steps opening/closing
inside their turn, in-turn messages naming the open turn/step — the
same semantics as the host invariant. Fixtures now use the real turn
gap (shadowed whole turn between head and keep) plus a mid-span case;
mutation-checked: turning the renumbering off reddens the real-gap
invariant case.
2026-10-16 16:14:41 +08:00
NolanHo 90d04f7aa0 fix(sidechat): keep turn/step skeletons in the compaction-tail seed (review round 1)
Two independent reviews converged on one blocking root cause: the first
construction kept only surface nodes, so the open turn's turn/start — which
an automatic compaction necessarily precedes (it fires inside the open
turn) — was dropped, silently bypassing the dangling-tool-call guard and
the synthetic interrupted-closers, and the seed violated the host's
requireOpenStep relational invariant.

Construction v2 drops only the forgotten span and keeps everything else
verbatim: the surviving head is wrapped in its enclosing turn/step
skeleton (closers recovered from the log), the checkpoint lands at its
surface slot as a plain append, and the keep window + tail keep their
skeletons — so lastTurnBoundary, the closers, and the snapshot path run on
the rebased log exactly as on the full copy. One uniform rebase for every
kept event; orphaned summaries rescan to the previous complete compaction;
the consumed group's log-only records ride out with the span they priced.

Spec rewritten to host-shaped fixtures (system/message {turn, step,
message}), adds the mid-turn automatic-compaction cases (closers +
dangling snapshot), the real relational-invariant harness, and structural
fallback assertions. Mutation-checked: skeleton wrap, remap branch, and
orphan rescan each turn their case red.
2026-10-16 16:14:41 +08:00
NolanHo b025331b99 docs(sidechat): compaction-tail seed plan; test: discriminate remap and interleave paths
- plan doc: measured problem, the surface-equivalence argument, the
  construction (surface-order head emission, tail rebase with honest
  degradation, foldSurface self-verification, full-copy fallback), the
  explicit non-goals, and the deployment e2e gate.
- spec: assert the trim fires in the remap case (a replace fully inside
  the tail must stay a REMAPPED replace, not degrade into the fallback
  copy) and pin the interleave fallback (a tail replace covering a
  surviving pre-cut node).
2026-10-16 16:14:41 +08:00
NolanHo f2443445aa test(sidechat): real-validator acceptance for the compaction-tail seed
Session.create must accept the rebased seed exactly as the routes pass it
(isSeeded + the inherited cut): this is the layer that once caught a seed
whose surfaceOp markers were stripped, so it gates every envelope decision
the rebasing makes — degraded replaces, remapped citations, kept tool
pairs. The constructor's appended end-seed marker lands as the child's
first own event, same shape as today's full-copy threads.
2026-10-16 16:14:41 +08:00
NolanHo 32e7d041ad feat(sidechat): seed from the last compaction instead of copying the whole parent log
A side-chat fork physically duplicated the parent's entire event log into
the child session (measured: a 32,674-event child on this deployment, 303k
duplicated rows across 36 seeded threads). After a summarizing compaction
the checkpoint user/message already replaces the shadowed span on the
model-visible surface, so the child only needs the surviving pre-cut
surface nodes, the checkpoint, and the post-compaction tail.

The rebased sequence is verified with the real fold (foldSurface) before
use: identical visible nodes to the parent, hence identical model context
and provider context-cache prefix. Any tail that cannot be proven
equivalent (dangling back-references, reordering replaces, no compaction)
falls back to today's verbatim full copy.
2026-10-16 16:14:41 +08:00