Repository navigation
feat(stats): memory_stats reports abandoned workers from abandoned_work (#728, slice 2) - #902
Conversation
…ended (#728, slice 2) A caller cancelled while its worker thread runs gets no result, yet the work goes on and, for a mutating tool, its writes land. Slice 1 only logged that outcome. worker_ledger now keeps, per tool, the workers running now, those still running after their caller was cancelled, and how each abandoned worker ended (completed / raised / cancelled). run_admitted records each run through one end callback (_Run), so a reader never sees an abandoned worker that is no longer active; a caller cancelled after its worker ended counts as abandoned too. memory_stats returns the ledger as `tool_workers`. test_memory_stats_mapping pins every field of memory_stats to its store reading: touching handler() put its 58 pre-existing survivors in the ADR-1122 diff-scoped mutation gate. Refs #728 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYtgfAGUYWDSLAfQPUp
…w they ended (#728, slice 2) fixup! feat(admission): memory_stats reports abandoned workers and how they ended (#728, slice 2) fix(test): _drain waited on one slot of remember's budget of 4, so it returned before the abandoned worker ended (unit, run 42168539790). It now holds the whole budget at a barrier. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYtgfAGUYWDSLAfQPUp
|
Generated by Claude Code |
|
Conflit de conception avec #903 (
La PR reste en draft jusque-là. |
#903 (540df96) brought abandoned_work, the same registry as worker_ledger. Keep main's admission.py, drop worker_ledger and its tests, and have memory_stats return abandoned_work.snapshot() as abandoned_workers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYtgfAGUYWDSLAfQPUp
|
Repris comme demandé dans
Generated by Claude Code |
…ker-report # Conflicts: # CHANGELOG.md
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @cdeust's task in 2m 3s —— View job Review of PR #902 (review 1 of 3)
None of the five reviews found a Blocker. Two Notes need no action before merge. CI was still running when I posted. Verdict: approve |
Review 1 of 3 (ADR-1119): PR #902No Blockers. I traced the diff against
I could not run ruff, pytest or Notes, no action before merge
Verdict: approve |
…pletion (#728, slice 5) (#946) * docs(admission): ADR-1125, a cancelled tool call's worker runs to completion (#728, slice 5) Issue #728 asks to keep work counted "until completion or a documented cooperative cancellation boundary". Slices 1-4 (#885, #903, #902, #936, #943) implement and prove the first: the slot is released by the worker's done callback, the caller awaits through asyncio.shield, abandoned workers are reported in memory_stats.abandoned_workers. Nothing forwards the cancellation into the worker thread, so no cooperative boundary exists. ADR-1125 records those semantics, amends ADR-0329 (the slot belongs to the worker), states what a handler that wants to stop early must specify, and lists the tests that hold each point. Mirror regenerated with wiki_decision_mirror.generate_mirror. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYs8nydviS39BjwT88E * fixup! docs(admission): ADR-1125, a cancelled tool call's worker runs to completion (#728, slice 5) --------- Co-authored-by: Claude <[email protected]>
Summary
Refs #728 (slice 2, does not close the issue). #903 added the
abandoned_workregistry. This PR exposes it throughmemory_stats, so a client can read it from the server process that answers.Change.
memory_statsnow returnsabandoned_workers, which isabandoned_work.snapshot():in_flight: per tool, the workers still running after their caller was cancelled;ended: per tool, how abandoned workers ended since the process started (completed / raised / cancelled).The tool description documents both fields. This PR keeps no second registry:
worker_ledger.py, from the first version of this PR, is removed aftermainwas merged in, as the owner asked.Type of change
memory_statsresponse.Test plan
tests_py/handlers/test_memory_stats_mapping.py(new) maps eachmemory_statsfield, includingabandoned_workers, to its source, on a stub store with the grooming helpers stubbed (no dependence on the clock). Changinghandler()brings its 58 pre-existing survivors into the ADR-1122 gate: the existing tests only checked types.GITHUB_BASE_REF=main python scripts/ci_mutation_diff.py):1 file(s), 0 failed, 0 untested.pytest tests_py/handlers tests_py/server tests_py/test_main.py: 1877 passed, 81 skipped. ruff 0.17.3 on the changed files andcheck_craftsmanship.py: OK.Audit notes
Breaking changes
None.
Reviewer checklist
memory_statsdescription.https://claude.ai/code/session_018kyZYtgfAGUYWDSLAfQPUp
Generated by Claude Code