feat(hub,web,cli): work-scoped liveness — derive in-progress tool work so autonomous rounds stop rendering as waiting (#2470)

* feat(hub,web,cli): work-scoped liveness — derive in-progress tool work so autonomous rounds stop rendering as waiting

thinking is round-scoped, not work-scoped: a session running an
autonomous loop between turns reports thinking=false while its tool
calls are still open, so the client renders "waiting" for hours. The
hub now sweeps open tool-call rows (getLiveToolWork) and marks the
session with derivedToolWork while any live call exists; the web
session list and status row render it as working. Stale
backgroundTaskCount values are cleared by the same sweep, and the
claude backend re-bumps thinking on autonomous-round assistant frames.

Ported from the fork line; the queued-thinking-grace refinement is
dropped here because that feature does not exist upstream.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* test(web): assert the ticker-era presence badge class, not animate-pulse

The low-rate ticker refactor (#2447) removed animate-pulse from the
presence badge; the derived-work test still expected it. data-presence
plus the badge background class is the visible contract now.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: miuiadmin <miuiadmin@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
admin
2026-11-18 08:12:48 +08:00
committed by GitHub
co-authored by Claude Code miuiadmin
parent 24153c3d37
commit a9e4d445cc
14 changed files with 866 additions and 5 deletions
+8
View File
@@ -624,6 +624,14 @@ export async function claudeRemote(opts: {
);
logger.debugLargeJson(`[claudeRemote] Message ${message.type}`, message);
// Autonomous rounds (background tasks, scheduled follow-ups) stream
// assistant messages after the previous result flipped thinking off;
// the SDK never re-fires its own thinking signal for them. Re-bump
// here so the hub renders the round as working, not waiting.
if (message.type === 'assistant') {
updateThinking(true);
}
if (message.type === 'user' && (message as SDKUserMessage).isReplay === true) {
const uuid = (message as SDKUserMessage).uuid;
if (uuid && pushedUuids.delete(uuid)) {