Skip to content

fix(devtools): keep the type daemon; release it at workspace disposal - #4334

Merged
Sinity merged 1 commit into
masterfrom
fix/keep-mypy-daemon-stop-at-disposal
Aug 27, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/keep-mypy-daemon-stop-at-disposal

Conversation

@Sinity

@Sinity Sinity commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Reverts the worktree exemption from #4333 and moves the daemon's shutdown to the point where the workspace is actually gone.

Problem

#4333 stopped using dmypy in non-primary checkouts to prevent the leak. Measured afterwards in a batch worktree:

time
plain mypy 50s
dmypy, cold start 51s
dmypy, warm 1s

A workspace is gated repeatedly while it is repaired, so only the first run pays for the cache. The exemption bought memory that a lifecycle hook releases anyway, at ~49s per re-gate.

mypy's own idle timeout does not solve it either: a daemon started with --timeout 10 was still running after twenty seconds idle, so that flag cannot be relied on.

Solution

sinnixd stops the daemon when it removes a worktree (sinnix 3f8fcea2), which releases the cache exactly when the workspace it describes disappears. devtools uses the daemon everywhere again.

Verification

devtools verify --quick green in the main checkout with the daemon in use.
sinnix side: nix build .#sinnixd and nix develop --command check green, with a test asserting removal invokes dmypy stop and tolerates a workspace with no provisioned venv.

Residual risk

A worktree removed outside agentctl workspace — by hand, or by git worktree remove directly — still leaks its daemon. The basetemp lifecycle from #4333 is unaffected and stays.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

…osal

Removing dmypy from worktrees traded 49 seconds per re-gate for memory that a
lifecycle hook releases anyway. Measured in a batch worktree: plain mypy 50s,
a cold daemon 51s, a warm daemon 1s — and a workspace is gated repeatedly
while it is repaired, so only the first run pays.

sinnixd now stops the daemon when it removes the worktree, which releases the
cache exactly when the workspace it describes is gone.

Verification: `devtools verify --quick` green in the main checkout with the
daemon in use.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 26484e95-45b8-49e4-a15f-56ab9c1cb1d1


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Sinity
Sinity merged commit 24be873 into master Aug 27, 2026
3 checks passed
@Sinity
Sinity deleted the fix/keep-mypy-daemon-stop-at-disposal branch August 27, 2026 12:12
Sinity added a commit that referenced this pull request Aug 27, 2026
…#4334)

## Summary
Reverts the worktree exemption from #4333 and moves the daemon's
shutdown to the point where the workspace is actually gone.

## Problem
#4333 stopped using dmypy in non-primary checkouts to prevent the leak.
Measured afterwards in a batch worktree:

| | time |
|---|---|
| plain mypy | 50s |
| dmypy, cold start | 51s |
| dmypy, warm | **1s** |

A workspace is gated repeatedly while it is repaired, so only the first
run pays for the cache. The exemption bought memory that a lifecycle
hook releases anyway, at ~49s per re-gate.

mypy's own idle timeout does not solve it either: a daemon started with
`--timeout 10` was still running after twenty seconds idle, so that flag
cannot be relied on.

## Solution
sinnixd stops the daemon when it removes a worktree (sinnix `3f8fcea2`),
which releases the cache exactly when the workspace it describes
disappears. devtools uses the daemon everywhere again.

## Verification
`devtools verify --quick` green in the main checkout with the daemon in
use.
sinnix side: `nix build .#sinnixd` and `nix develop --command check`
green, with a test asserting removal invokes `dmypy stop` and tolerates
a workspace with no provisioned venv.

## Residual risk
A worktree removed outside `agentctl workspace` — by hand, or by `git
worktree remove` directly — still leaks its daemon. The basetemp
lifecycle from #4333 is unaffected and stays.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Aug 28, 2026
…#4334)

## Summary
Reverts the worktree exemption from #4333 and moves the daemon's
shutdown to the point where the workspace is actually gone.

## Problem
#4333 stopped using dmypy in non-primary checkouts to prevent the leak.
Measured afterwards in a batch worktree:

| | time |
|---|---|
| plain mypy | 50s |
| dmypy, cold start | 51s |
| dmypy, warm | **1s** |

A workspace is gated repeatedly while it is repaired, so only the first
run pays for the cache. The exemption bought memory that a lifecycle
hook releases anyway, at ~49s per re-gate.

mypy's own idle timeout does not solve it either: a daemon started with
`--timeout 10` was still running after twenty seconds idle, so that flag
cannot be relied on.

## Solution
sinnixd stops the daemon when it removes a worktree (sinnix `3f8fcea2`),
which releases the cache exactly when the workspace it describes
disappears. devtools uses the daemon everywhere again.

## Verification
`devtools verify --quick` green in the main checkout with the daemon in
use.
sinnix side: `nix build .#sinnixd` and `nix develop --command check`
green, with a test asserting removal invokes `dmypy stop` and tolerates
a workspace with no provisioned venv.

## Residual risk
A worktree removed outside `agentctl workspace` — by hand, or by `git
worktree remove` directly — still leaks its daemon. The basetemp
lifecycle from #4333 is unaffected and stays.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 1, 2026
…#4334)

## Summary
Reverts the worktree exemption from #4333 and moves the daemon's
shutdown to the point where the workspace is actually gone.

## Problem
#4333 stopped using dmypy in non-primary checkouts to prevent the leak.
Measured afterwards in a batch worktree:

| | time |
|---|---|
| plain mypy | 50s |
| dmypy, cold start | 51s |
| dmypy, warm | **1s** |

A workspace is gated repeatedly while it is repaired, so only the first
run pays for the cache. The exemption bought memory that a lifecycle
hook releases anyway, at ~49s per re-gate.

mypy's own idle timeout does not solve it either: a daemon started with
`--timeout 10` was still running after twenty seconds idle, so that flag
cannot be relied on.

## Solution
sinnixd stops the daemon when it removes a worktree (sinnix `3f8fcea2`),
which releases the cache exactly when the workspace it describes
disappears. devtools uses the daemon everywhere again.

## Verification
`devtools verify --quick` green in the main checkout with the daemon in
use.
sinnix side: `nix build .#sinnixd` and `nix develop --command check`
green, with a test asserting removal invokes `dmypy stop` and tolerates
a workspace with no provisioned venv.

## Residual risk
A worktree removed outside `agentctl workspace` — by hand, or by `git
worktree remove` directly — still leaks its daemon. The basetemp
lifecycle from #4333 is unaffected and stays.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

1 participant