Skip to content

Stabilize Cursor Agent adopt transcript bridge - #109

Merged
deepcoldy merged 6 commits into
deepcoldy:masterfrom
LucasIcarus:feat/adopt-cursor-agent
Jun 5, 2026
Merged

deepcoldy merged 6 commits into
deepcoldy:masterfrom
LucasIcarus:feat/adopt-cursor-agent

Conversation

@LucasIcarus

@LucasIcarus LucasIcarus commented Jun 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add a Cursor Agent transcript reader that resolves adopted sessions through Cursor chat metadata and distills final replies into the existing Codex bridge queue.
  • Wire Cursor adopt sessions into transcript fallback while keeping botmux-spawned Cursor sessions on the existing botmux send flow.
  • Stabilize attribution for late transcript creation, partial tails, local terminal turns, and Cursor-only probe logging without broad bridge renames.

Test plan

  • pnpm exec vitest run test/codex-bridge-queue.test.ts test/cursor-transcript.test.ts
  • pnpm build
  • Replaced the local mise-installed botmux dist with this branch build and restarted via ~/repair-botmux-mise.sh; botmux status reported all processes online.

Notes

  • The branch intentionally keeps the existing codexBridge* runtime naming and does not introduce the previous structured-bridge-* file rename.

@LucasIcarus
LucasIcarus requested a review from deepcoldy as a code owner June 4, 2026 05:05
@LucasIcarus
LucasIcarus marked this pull request as draft June 4, 2026 10:18
@LucasIcarus LucasIcarus changed the title feat(adopt): harvest cursor-agent replies via transcript bridge Stabilize Cursor adopt transcript bridge Jun 4, 2026
@LucasIcarus
LucasIcarus marked this pull request as ready for review June 4, 2026 11:54
@LucasIcarus
LucasIcarus marked this pull request as draft June 4, 2026 12:27
LucasIcarus and others added 5 commits June 5, 2026 10:41
Adopted cursor-agent sessions had no transcript bridge, so the model's
replies were only mirrored as terminal screenshots and never forwarded
to the Lark thread (unlike Claude/Codex/CoCo/MTR). Add a Cursor reader
that binds the adopt pid to its chat via the open store.db fd, locates
the append-only agent-transcript JSONL by chatId, and drains user /
final-answer events into the shared CodexBridgeQueue.

Final-answer detection is simpler than Codex's phase marker: cursor-agent
ends a turn with a text-only assistant line, while every intermediate step
carries a tool_use block. Cursor's JSONL has no per-event timestamp, so the
bridge baselines by byte offset at adopt time instead of the timestamp
split-live the other CLIs use; pre-adopt history stays behind the offset
and is never replayed.

- src/services/cursor-transcript.ts: pid -> store.db -> chatId -> jsonl
  resolver + byte-offset drain producing CodexBridgeEvent
- src/worker.ts: wire cursor into the structured-bridge plumbing (dispatch,
  fallback-active scoped to adopt, baseline attach + preamble, late-attach
  poller, cliSessionId notify)
- src/core/worker-pool.ts: forward the adopt pid/cwd/sessionId for cursor
- test/cursor-transcript.test.ts: reader unit tests

Co-authored-by: Cursor <[email protected]>
Document where Cursor sits on the streaming(Claude) vs discrete(Codex)
spectrum: discrete complete events (no growing-prefix snapshots, verified
empirically) but multi-event turns with a definite text-only terminator,
which is why the reader distills each turn down to Codex's (user,
assistant_final) shape and reuses CodexBridgeQueue unchanged. Also spell out
the two intentional consequences (per-step narration is not relayed;
interrupted turns emit nothing). Add tests locking the multi-turn
distillation and the interrupted-turn no-emit behaviour.

Co-authored-by: Cursor <[email protected]>
Handle Cursor-specific transcript quirks so adopted sessions forward the intended final reply promptly without replaying history or leaking internal reasoning text.

Co-authored-by: Cursor <[email protected]>
@LucasIcarus
LucasIcarus force-pushed the feat/adopt-cursor-agent branch from ccfe76a to 25d85b8 Compare June 5, 2026 03:26
@LucasIcarus LucasIcarus changed the title Stabilize Cursor adopt transcript bridge Stabilize Cursor Agent adopt transcript bridge Jun 5, 2026
@LucasIcarus
LucasIcarus marked this pull request as ready for review June 5, 2026 03:28
@deepcoldy
deepcoldy merged commit 17d8cb3 into deepcoldy:master Jun 5, 2026
@LucasIcarus
LucasIcarus deleted the feat/adopt-cursor-agent branch July 17, 2026 06:31
baicaicc added a commit to baicaicc/botmux that referenced this pull request Oct 26, 2026
…ings (deepcoldy#109)

Restored from integrations/botmux/native-sessions.patch at
baicaicc/allInOne@3aff0a9 (patch version 17/28).

Part of baicaicc/allInOne#144

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jiyuuDev added a commit to zsnjuts/botmux that referenced this pull request Nov 1, 2026
)

控制可能先于 canonical 落库到达(流式卡片先发、admission 还在提交),所以
canonical 缺失时先照旧重试;控制写入超过 5 分钟仍不存在,说明会话从未落库或
已被删除,按 ignored 收尾(已有控制操作一并结算),不再每 6 秒重投一次。

Co-Authored-By: Claude <[email protected]>
jiyuuDev added a commit to zsnjuts/botmux that referenced this pull request Nov 1, 2026
)

控制可能先于 canonical 落库到达(流式卡片先发、admission 还在提交),所以
canonical 缺失时先照旧重试;控制写入超过 5 分钟仍不存在,说明会话从未落库或
已被删除,按 ignored 收尾(已有控制操作一并结算),不再每 6 秒重投一次。

Co-Authored-By: Claude <[email protected]>
jiyuuDev added a commit to zsnjuts/botmux that referenced this pull request Nov 1, 2026
…y#109 / deepcoldy#111) (#65)

* fix(primary): canonical Session 一直不存在的会话控制按终态忽略,不再无限重投(Mew deepcoldy#109)

控制可能先于 canonical 落库到达(流式卡片先发、admission 还在提交),所以
canonical 缺失时先照旧重试;控制写入超过 5 分钟仍不存在,说明会话从未落库或
已被删除,按 ignored 收尾(已有控制操作一并结算),不再每 6 秒重投一次。

Co-Authored-By: Claude <[email protected]>

* fix(primary): 本副本仍在服务会话时孤儿控制直接收尾,不再无限延后(Mew deepcoldy#111)

双副本下,孤儿扫描只跳过本副本有本地 owner 的会话,另一个副本每个扫描周期都会给同一
会话追加一条 terminalize_orphan;由 owner 所在副本认领时一律 Deferred,等一个可能永远
不会退场的 owner,后面的扫描行越堆越多。本地 owner 存活就说明不是孤儿,按终态 ignored
收尾;owner 退场后由下一轮扫描重新证明。认领了已失败恢复轮次的残留 owner 仍先放弃投影。

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
deepcoldy pushed a commit that referenced this pull request Nov 26, 2026
合码窗口 master 再进 4 提交。与本 PR 原创代码仅 daemon.ts、card-handler.ts
两文件重叠且改动区段不相邻(不同函数,相隔数十至数千行),git 自动合并零冲突。

合并 tree fd4c644 与 git merge-tree --write-tree 预测完全一致(三点一线)。
合并树验证:bun run build(tsc/typecheck/audit)通过;定向 458 用例全绿,
含本 PR 核心(streaming-card/capacity/session-contract-gateway)与新进提交
自带交集测试(ask-chat-scope/scheduler-silent/trigger-session);
bun.lock/package.json 未变。

按复审意见不走 #109 豁免,本 merge commit 触发全新完整 CI 首跑后再合。

Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Nov 27, 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.

2 participants