Skip to content

test(control): cross-process control channel tests#120

Merged
sebyx07 merged 4 commits into
mainfrom
fix/06-cross-process-control
Jul 19, 2026
Merged

test(control): cross-process control channel tests#120
sebyx07 merged 4 commits into
mainfrom
fix/06-cross-process-control

Conversation

@sebyx07

@sebyx07 sebyx07 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add TestControlChannelCrossProcess class verifying stop/pause are written to control.json immediately (honored in one cycle)
  • Tests that resume() clears the channel so a stale signal doesn't re-halt the fresh run
  • Two stop+cleanup race tests using a second StateManager instance to simulate the real cross-process scenario (control process vs. orchestrator process): skip-cleanup when session active, proceed once released

Test plan

  • uv run pytest tests/core/test_control.py — 77 passed
  • ruff check + ruff format --check — clean
  • mypy . — 305 files, no issues

🤖 Generated with Claude Code

sebyx07 and others added 4 commits July 18, 2026 18:52
Stop/pause from claudetm-server/MCP/CLI now reach a running orchestrator
across process boundaries. request_shutdown only set a process-local
threading.Event, invisible to a CLI-launched run in another process, so
POST /control/stop returned 200 while work continued.

- Add ControlChannel (control.json) with durable atomic writes + tolerant
  reads (missing/corrupt/unknown-action -> no request)
- ControlManager.stop/pause write the durable signal; resume clears it
- Orchestrator polls the channel each loop cycle beside
  is_cancellation_requested(); stop -> "stopped", pause -> "paused"
- ShutdownManager observes a bound durable-stop check so in-cycle CI
  waits (interruptible_sleep) also honour a cross-process stop

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The orchestrator holds one long-lived in-memory TaskState and saves it
~31 times per run. Between saves, another process (REST/MCP/CLI via
ControlManager) may stop/pause the run or patch its options — the
orchestrator's next save clobbered those back (stopped->working is a
valid transition; stale options reverted a PATCH /config).

- Add StateManager.save_state_merged: re-reads on-disk state under the
  same exclusive lock as the write and overlays control-plane fields —
  options always win (config patch adopted in place), and an external
  stopped/paused is kept for any incoming status (never resumed except
  via an explicit resume on the plain save_state path). Keeping the disk
  status makes the transition a no-op, so a terminal write racing a stop
  can't trip InvalidStateTransitionError.
- Route all orchestrator save_state sites through save_state_merged.
- Add CONTROL_AUTHORITATIVE_STATUSES; save_state now returns the state.
- Tests: merged-save unit tests + cross-process control integration
  (stop/pause/config-patch survive a second StateManager's save).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Wait (bounded, env-configurable) for is_session_active() to go
  false before cleanup_on_success; skip cleanup if a live session
  persists so a cross-process orchestrator's next save_state can't
  recreate a half-populated state dir.
- Log + report dropped pending mailbox count on cleanup.
- Add 5 tests: dropped-count logging, skip-on-active, proceed-on-
  release, immediate-when-inactive.

Co-Authored-By: Claude <noreply@anthropic.com>
- TestControlChannelCrossProcess: verify stop/pause are written to
  control.json and readable in one poll cycle (orchestrator first read)
- test_resume_clears_channel: resume() clears stale stop from channel
- Two stop+cleanup race tests using a second StateManager instance to
  simulate real cross-process scenario (skipped vs proceeds variants)

Co-Authored-By: Claude <noreply@anthropic.com>
@sebyx07 sebyx07 added the claudetm PRs created by Claude Task Master label Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 5d485f99-393c-4d42-a869-a9a2110c701b

📥 Commits

Reviewing files that changed from the base of the PR and between da56e4d and 46aab0a.

📒 Files selected for processing (9)
  • src/claude_task_master/core/control.py
  • src/claude_task_master/core/control_channel.py
  • src/claude_task_master/core/orchestrator.py
  • src/claude_task_master/core/shutdown.py
  • src/claude_task_master/core/state.py
  • src/claude_task_master/core/state_exceptions.py
  • tests/core/test_control.py
  • tests/core/test_orchestrator_mailbox.py
  • tests/core/test_state.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/06-cross-process-control

Comment @coderabbitai help to get the list of available commands.

@sebyx07
sebyx07 merged commit fcdca00 into main Jul 19, 2026
8 checks passed
@sebyx07
sebyx07 deleted the fix/06-cross-process-control branch July 19, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudetm PRs created by Claude Task Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant