Skip to content

fix: mark Lead agents in handle_status so CLI filters them from coworker list#2332

Merged
btucker merged 1 commit intomainfrom
blindspots/dogfood/20260406-220051
Apr 7, 2026
Merged

fix: mark Lead agents in handle_status so CLI filters them from coworker list#2332
btucker merged 1 commit intomainfrom
blindspots/dogfood/20260406-220051

Conversation

@btucker
Copy link
Copy Markdown
Owner

@btucker btucker commented Apr 7, 2026

Summary

midtown status was listing the project lead and topic-channel leads in the Coworkers section alongside actual workers. Discovered while dogfooding the lead → task → worker → PR → merge flow.

Coworkers
─────────────────────────────
btucker-reviewer running  -
midtown          running  -      ← project lead, should be filtered
ink-blot         running  !1 ...
ops              running  -      ← channel lead, should be filtered
tool-echo        running  !2 ...

Root cause

handle_status in src/daemon_v2/rpc/handlers.rs emits coworker_type: "lead" (a string label) for each running agent, but the CLI's Response::Coworkers deserializer (CoworkerInfo) reads is_channel_lead (a bool flag) — different field names. With #[serde(default)] on is_channel_lead, the flag silently defaulted to false for every agent, so the display formatter's !cw.is_channel_lead filter never excluded leads.

The companion handle_agent_list does the right thing because it emits the kind field that the CLI also recognizes — that's why midtown agent list correctly classifies agents while midtown status doesn't.

Fix

One field added to the handle_status coworker JSON:

"is_channel_lead": matches!(a.kind, AgentKind::Lead),

Both project leads (midtown-project-lead) and topic-channel leads (midtown-channel-lead) are AgentKind::Lead, so a single check covers both.

Test plan

  • New regression test handle_status_marks_lead_coworkers_as_channel_leads in src/daemon_v2/rpc/rpc_tests.rs — builds a Projections with one running worker, one running project lead, and one running topic-channel lead; asserts the worker has is_channel_lead=false and both leads have is_channel_lead=true. Confirmed failing on the unfixed code (`Null` in place of the bool), passing after the fix.
  • All 1537 lib tests pass
  • Discovered via dogfood: `midtown status` listed `midtown` and `ops` in the Coworkers section. After fix, only actual workers appear.

🌃 Co-built with Midtown

…ker list

The daemon's handle_status emits each running agent into the coworkers
JSON array but never sets is_channel_lead. The CLI deserializes the
response into Response::Coworkers (CoworkerInfo with #[serde(default)]),
so is_channel_lead silently defaults to false for project leads and
topic-channel leads. The display formatter then fails to filter them
out, and `midtown status` shows leads alongside actual workers.

Discovered via dogfood: `midtown status` listed `midtown` (project
lead) and `ops` (channel lead) in the Coworkers section. Failing
reproduction test added in rpc_tests.rs.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.95%. Comparing base (05897b0) to head (10c05d9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2332      +/-   ##
==========================================
+ Coverage   63.70%   63.95%   +0.25%     
==========================================
  Files         100      100              
  Lines       38582    38592      +10     
==========================================
+ Hits        24578    24683     +105     
+ Misses      14004    13909      -95     
Files with missing lines Coverage Δ
src/daemon_v2/rpc/handlers.rs 86.73% <100.00%> (+0.02%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@btucker btucker merged commit 52c7309 into main Apr 7, 2026
13 checks passed
@btucker btucker deleted the blindspots/dogfood/20260406-220051 branch April 7, 2026 03:37
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