Skip to content

fix(acp): report live connection status - #1152

Merged
xintaofei merged 3 commits into
spacering-net:mainfrom
kogekiplay:fix/acp-connection-status-report
Nov 15, 2026
Merged

xintaofei merged 3 commits into
spacering-net:mainfrom
kogekiplay:fix/acp-connection-status-report

Conversation

@kogekiplay

@kogekiplay kogekiplay commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

acp_list_connections could report a live ACP session as connecting indefinitely. The connection map carried a spawn-time status duplicate while subsequent transitions were published to the shared SessionState. The list endpoint read the stale duplicate instead of the authoritative session state.

This was reproduced against the running desktop candidate: both the claude_code and codex list rows reported connecting, while their session snapshots reported connected.

Change

SessionState.status is now the sole status source for connection inventory and lifecycle checks:

  • ConnectionManager::list_connections snapshots connection identity/state handles and reports each row from the shared session state.
  • live_or_draining_agent_names uses the same authoritative state.
  • The redundant AgentConnection.status field and its stale info() accessor are removed.

Regression tests verify that a status transition from connected to prompting is reflected by list_connections, and that the restore gate counts a handshaking session while excluding sessions that have published error or disconnected. The restore-gate test and comment correction were contributed by @xintaofei in a19e8a02.

Validation

  • pnpm build
  • cargo test --features test-utils acp::manager::tests::list_connections_reports_live_session_status
  • cargo test --features test-utils acp::manager::tests --lib — 144 passed
  • git diff --check

The repository's current rustfmt check reports pre-existing formatting differences across the official baseline; this change was not used to reformat unrelated files.

The maintainer additionally reported 2,585 ACP tests, 73 backup-command tests and desktop Clippy passing on the follow-up commit. CI for that new head is tracked separately from the earlier 10/10 run.

Scope

This PR corrects the ACP connection inventory used by external acp_list_connections callers and the backup-restore lifecycle gate. The frontend API wrapper currently has no caller in src/. It does not claim to resolve the separate Web Content long-term memory growth investigation; that remains under observation with independent physical-footprint sampling.

The list_connections comment still described the spawn-time status
field the previous commit removed. And the live_or_draining_agent_names
filter on Connecting/Connected/Prompting only takes effect now that it
reads SessionState: before, the frozen spawn-time copy reported every
map entry as Connecting. Add a test that a connection still in its
handshake counts and one that has published Error/Disconnected does not.
@xintaofei

Copy link
Copy Markdown
Collaborator

Verdict: the approach holds — ready to merge after one small follow-up commit.

I confirmed the root cause. On the base branch, AgentConnection.status was set to Connecting once at spawn and nothing ever wrote to it again. Every transition goes through emit_with_state into SessionState.status. Removing the duplicate and reading SessionState is the right fix, and it matches what the other inventory readers already do (touch, sweep_idle, list_active_sessions). Lock order is unchanged: holding the connections map lock while reading a session's state (live_or_draining_agent_names) is the same order the existing session lookup at src-tauri/src/acp/manager.rs:1286 uses.

Pushed on top (one commit):

  • src-tauri/src/acp/manager.rs:3460: the list_connections comment still described "AgentConnection.status is only the spawn-time placeholder". The second commit removes that field, so I reworded the comment.
  • Added live_or_draining_agent_names_follows_session_status (manager.rs:5546). This PR changes what the backup-restore gate does. Its Connecting | Connected | Prompting filter used to read the frozen copy, so every map entry counted. Now a connection that has published Error/Disconnected and is still unwinding is excluded, which is what src-tauri/src/commands/backup/restore.rs:363-365 documents. The test pins it: a connection still in its handshake counts, an errored or closed one doesn't.

Notes, no change needed in this PR:

  • The description says the endpoint is consumed by the frontend. acpListConnections (src/lib/api.ts:499, src/lib/tauri.ts:175) has no caller in src/. The users of this fix are external callers of acp_list_connections and the restore gate.
  • Older gap, not caused by this PR: a connection that ends on its own is removed from the map by ConnectionCleanupGuard without being added to draining (only disconnect adds it). So an agent that is still exiting after its connection ended was already invisible to the restore gate. This PR starts that window at the terminal StatusChanged instead of at map removal, which is only microseconds earlier. Possible follow-up: have the guard add the child to draining the way disconnect does.

Verified with the 1.97.0 toolchain:

  • cargo clippy --all-targets --features test-utils -- -D warnings: clean.
  • acp:: lib tests: 2585 passed, 0 failed (including acp::manager::tests and acp::lifecycle::tests).
  • commands::backup tests: 73 passed.
  • My additions are rustfmt-clean. The rest of manager.rs already has rustfmt differences, as you noted.

The changes were pushed to this pull request (1 file, +35/-6).


🤖 Generated with Codeg

@xintaofei
xintaofei merged commit dab2943 into spacering-net:main Nov 15, 2026
10 checks passed
xintaofei added a commit that referenced this pull request Nov 15, 2026
This release keeps tasks running while agents finish background work, makes configuration sync safer and adds appearance settings to it, adds Claude Code cache mode settings, reduces memory retained after closing conversations, and updates several agents.

## New

- **Tasks and automation runs now wait for background work to finish.** Previously a run could end, and its background commands or sub-agents be cut off, as soon as the agent's reply finished. Now the run stays open until that work completes and the agent's follow-up reply arrives, and that reply becomes the run's summary. The task card shows how many background jobs are still running and offers a "Stop waiting" action.
- **Configuration sync now includes appearance settings**: light/dark mode, theme color, zoom, fonts, background display and custom styles.
- **New Cache mode settings in the Claude Code config panel**, with switches for the one-hour prompt cache of the main conversation and of sub-agents.

## Improved

- **Updated Claude Code (claude-agent-acp 0.107.0) and OpenCode to 2.3.0, DeepSeek to 0.11.0, Cursor to 2026.11.13, Kimi Code to 2.6.2, Qoder to 1.1.89, ZCode to 0.85.2 and Command Code to 1.89.1.** The DeepSeek settings follow the new version's setup: it uses the Anthropic-compatible endpoint by default and requires Node.js 22.19.0 or later.

## Fixed

- **Configuration sync no longer overwrites settings uploaded from another machine.** Fresh installs and machines that have not synced in a while no longer replace a newer remote snapshot. Instead, you can see where the snapshot came from and choose to restore it or replace it. Opening codeg in a new browser also no longer resets the server's appearance settings. (#1149, reported by @zinsser901224)
- **Reduced memory retained after closing a conversation that showed a streamed reply.** (#1157 by @kogekiplay)
- **Connected agent sessions are no longer shown as "connecting".** (#1152 by @kogekiplay)

Thanks to @kogekiplay for contributing to this release, and to @zinsser901224 for reporting the sync issue.

-----------------------------

# 发布版本 0.45.0

这一版让任务等智能体的后台工作完成后再结束,提升配置同步的安全性并支持同步外观设置,新增 Claude Code 缓存模式设置,减少关闭会话后的内存残留,并更新多个智能体。

## 新增

- **待办任务和自动化运行会等后台工作完成后再结束。** 以前智能体一回复完,运行就可能结束,后台命令或子智能体也会被中断。现在会等这些工作完成、智能体发出后续回复后再结束,并以这条回复作为运行总结。任务卡片会显示仍在运行的后台工作数量,也可以随时「停止等待」。
- **配置同步现在包含外观设置**:明暗模式、主题色、缩放、字体、背景显示和自定义样式。
- **Claude Code 配置面板新增「缓存模式」设置**,可分别开关主会话和子智能体的一小时提示词缓存。

## 改进

- **Claude Code(claude-agent-acp)更新至 0.107.0,OpenCode 更新至 2.3.0,DeepSeek 更新至 0.11.0,Cursor 更新至 2026.11.13,Kimi Code 更新至 2.6.2,Qoder 更新至 1.1.89,ZCode 更新至 0.85.2,Command Code 更新至 1.89.1。** DeepSeek 设置已适配新版的配置方式:默认使用 Anthropic 兼容接口,并要求 Node.js 22.19.0 及以上版本。

## 修复

- **配置同步不再覆盖其他设备上传的配置。** 新安装或久未同步的设备不会再替换云端较新的快照,而是显示快照的来源,由你选择恢复还是替换。在新浏览器中打开 codeg 也不会再重置服务器上的外观设置。(#1149,由 @zinsser901224 反馈)
- **减少关闭显示过流式回复的会话后的内存残留。**(#1157 by @kogekiplay)
- **修复已连接的智能体会话被显示为「连接中」的问题。**(#1152 by @kogekiplay)

感谢 @kogekiplay 为本次发布做出的贡献,也感谢 @zinsser901224 反馈同步问题。
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