anthropics / anthropics/claude-code

No way to see which routine sessions are still alive and holding resources

未关闭
#93,552 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:routines area:ui enhancement
主要语言
Python
星标
145k
派生
23.1k
PR 合并指标
PR 指标待抓取

描述

## Summary

A routine run whose session has exited and one whose session is still resident on a `remote-control` bridge look identical in the UI. Both display as succeeded. Nothing indicates a process is still alive.

Fourteen sessions accumulated on my bridge over ten days, one per routine firing, none exiting after their run completed (#93549): ~1.9 GB RSS combined, each ticking 0.5–2% CPU while idle. The only two signals I found were the `claude remote-control` terminal's attached-session count and `ps` on the host, neither of which is intuitively the surface to monitor.

Leaked sessions hold the bridge's concurrent-session capacity. When it fills, the next firing cannot spawn and a scheduled job silently stops running, with no warning surface in front of it and no failed run to show for it afterwards. Being unable to *find* a completed routine is an inconvenience; being unable to tell that something is still consuming resources means the problem stays invisible until it breaks something.

## Request

1. Track session liveness server-side, so a session whose process has exited stops reporting `active`.
2. Make a live session visibly distinct from a finished one wherever runs or sessions are listed.
3. Surface a per-environment count of live sessions against capacity. That number predicts the outage, and the bridge terminal already prints it locally.

## There is no liveness signal in the API either

`GET /v1/code/sessions?trigger_id=…` returns `status` and `worker_status`. Neither tracks whether the process is alive:

| Session state | `status` | `worker_status` | process |
|---|---|---|---|
| Mid-turn | `active` | `running` | alive |
| Run completed, process leaked | `active` | `idle` | alive |
| `SIGTERM`ed hours earlier | `active` | `idle` | **dead** |
| Archived | `archived` | `idle` | dead |

`worker_status` only separates "running a turn" from "not"; `status` only separates archived from not. A leaked session and one killed hours ago are indistinguishable.

Ten sessions I `SIGTERM`ed at 01:00 still reported `active` at 02:45, processes long gone. So the server's own record of which sessions are alive is wrong, and no client could render the truth from it today.

## Contributing factor

Fired one-shot routines are hidden from the routines list by default, and the filter menu (All / Active / Paused / Auto-Disabled / On Hold) does not reach them: a fired one-shot is `enabled: false` with `ended_reason: "run_once_fired"`, yet does not appear under "Auto-Disabled", and "All" excludes it. The control that reveals it is "include completed", under **sort**. So a leaked one-shot session is hidden twice over.

## Environment

Claude Code 2.1.247, Claude Desktop app, macOS (Apple Silicon), cloud routines targeting a `kind: bridge` environment.

## Related

- #93549: routine sessions are never sent `end_session` on completion, the leak this defect makes invisible
- #72308, #68626, #73631: session and process leaks on other spawners
- #74682: auto-archive routine sessions after completion
- #86115: paused scheduled tasks disappearing from the Routines list

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with GET /v1/code/sessions?trigger_id=… and the sessions and routines list surfaces described in the issue. Compare the existing status and worker_status values with process liveness, then trace how completed one-shot routines are filtered. Done means dead sessions no longer report active, live and finished sessions are distinct, and each environment shows live sessions against capacity.

由索引模型根据 Issue 内容生成。

评估

领域
backend-api-design, frontend, observability
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。