Skip to content

stats: running_processes counts foreground commands - #716

Merged
lydakis merged 1 commit into
mainfrom
claude/wave2-running-processes
Nov 7, 2026
Merged

lydakis merged 1 commit into
mainfrom
claude/wave2-running-processes

Conversation

@lydakis

@lydakis lydakis commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Wave 2 (#670), H-c1. Daemon bug fix (announced in the thread before this PR).

Cause

stats.running_processes was SELECT count(*) FROM processes WHERE status='running'. Only background commands get a processes row, so a foreground command holding one of process_limit's slots showed running_processes: 0 beside process_limit: 1. The docs say the bound covers foreground and background.

Change

  • Registry counts foreground commands while they hold a slot (Counted, an atomic increment on taking the slot and decrement on drop, beside the existing pending counter).
  • stats reports running_processes = the store's count (background commands not yet recorded, queued or running) + foreground commands running now. queued_processes unchanged and still a subset.
  • The idle-exit check is unchanged (it already requires no live turn, so a foreground command can't be running then).
  • Docs (RUST_PROTOTYPE.md) say what is counted.

Fast and light

One relaxed atomic add and sub per foreground command; no store work added; stats reads one more atomic. Same cost at 1 bot or thousands.

Tests

tests/test_runtime.py test_running_processes_counts_a_foreground_command: 1 while a foreground sleep runs, 0 after. Fails on main (0 while running). The background-command tests still pass.

Upgrade notes

None. Monitors reading running_processes now see foreground commands.

@lydakis lydakis self-assigned this Nov 5, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T23:40:11.695253Z dad5b85 New commits
🔒 Security Review ✅ Completed 2026-11-05T23:56:03.007321Z 65d224b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65d224b5d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/mod.rs Resolved
Comment thread src/tools.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 947c4ce17b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/turn.rs Resolved
@lydakis
lydakis force-pushed the claude/wave2-running-processes branch from 08d98b8 to 3a0eb27 Compare November 6, 2026 04:42
@lydakis
lydakis force-pushed the claude/wave2-running-processes branch from 3a0eb27 to dad5b85 Compare November 6, 2026 23:39

lydakis commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

The runtime failure on dad5b85 is test_answered's test_a_slow_answer_parks_the_turn_and_its_error_is_the_result. Its stats read saw active_turns 1, where it expected 0, just after turn_waiting arrived. The turn was still letting go of its slot when the stats were read, so this is a timing race in the test. It is not caused by this PR: the PR changes only running_processes (foreground shell commands), and that test runs no shell. The test passed 6 of 6 times locally on this head. Every other runtime module passed. This session can't re-run CI, so the failed job needs a re-run.


Generated by Claude Code

@lydakis
lydakis merged commit a7b4f27 into main Nov 7, 2026
4 of 5 checks passed
@lydakis
lydakis deleted the claude/wave2-running-processes branch November 7, 2026 01:15
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