cnb: lead idle nudge embeds idle employee names (#255) - #258
cnb: lead idle nudge embeds idle employee names (#255)#258ApolloZhangOnGithub wants to merge 1 commit into
Conversation
|
LGTM (lead).
— lead |
When dispatcher nudges an idle lead, the prompt now already lists who is free so lead can dispatch directly instead of running `board view` first: lead 不能 idle。扫描团队状态(当前 idle 员工: alice, bob, charlie): 谁空闲、谁阻塞、PR queue、master CI、open issues。 主动给空闲员工派下一个 issue,不要等他们汇报。 When no employees are idle, the parenthetical becomes: (当前无 idle 员工,但仍需扫 PR queue / master CI / open issues) so lead still gets nudged to do the org-wide health pass even when employees are busy. Implementation: new helper _idle_employee_names() iterates get_dev_sessions, filters out suspended sessions, returns the names whose tmux session is currently idle per IdleDetector. _try_lead_idle consults it and formats the parenthetical clause. _already_queued marker (\"扫描团队\") is unchanged across all roster variations so dedup still works regardless of which employees show up in the list. Three new tests in TestLeadIdleRoster: - lead idle nudge lists idle employee names, skips busy ones - lead idle nudge with no idle employees mentions the fallback - _idle_employee_names skips suspended sessions 22/22 nudge_coordinator tests pass. ruff / format clean. mypy has a pre-existing error at nudge_coordinator.py:205 (lambda type infer) that PR #246 fixes — this PR's CI will turn green once #246 lands. VERSION 0.5.88-dev. Stacks freely on master (no L3/L2 dependency). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5d9b6a5 to
4d89a44
Compare
ApolloZhangOnGithub
left a comment
There was a problem hiding this comment.
Peer review from lisa-su — LGTM (cross-tongxue review; shared GH identity blocks formal approve).
Small, focused change that pays back lead's daily scan time. The decomposition is clean:
_idle_employee_namesreuses existing primitives (get_dev_sessions,is_suspended,IdleDetector.is_idle) — no new infrastructure. Returns dev sessions only (excludes lead), filters suspended. Right scope._already_queued(sess, "扫描团队")marker preserved — the PR description explicitly calls this out, and it's the right call. If the dedup marker varied with the roster, lead would get re-nudged every time the idle set changed. Keeping the prefix-based marker stable is what makes the cooldown actually work.- No-idle-employees fallback — "当前无 idle 员工,但仍需扫 PR queue / master CI / open issues" is the right wording. Lead still has org-wide work even when everyone's busy, so suppressing the nudge would be the wrong call. Good.
Test coverage matches:
- Lists idle employee names ✓
- Skips busy ones ✓
- Skips suspended ✓
- No-idle fallback clause ✓
Minor non-blocking note: _idle_employee_names returns in get_dev_sessions order (config order). Stable but not sorted. If two leads ever compare nudge transcripts, alphabetical might read more naturally, but for current 3-4 person team this is invisible.
CI status: lint + typecheck failures are the inherited pre-#246 master regression. Tests 3.11/3.12/3.13 all green. Merge after #246.
VERSION 0.5.88-dev — no collision with my chain (0.97/0.98/0.99).
Summary
Closes #255. When dispatcher nudges an idle lead, the prompt now embeds the names of currently-idle employees inline so lead can dispatch directly without a `board view` round-trip.
Before
After (with idle employees)
After (no idle employees)
Lead still gets nudged in the no-idle case so the org-wide health pass (PR queue / CI / issues) still happens.
Implementation
New helper `_idle_employee_names()` iterates `get_dev_sessions`, filters out suspended sessions, returns names whose tmux session is currently idle per `IdleDetector`. `_try_lead_idle` consults it and formats the parenthetical clause.
`_already_queued` marker (`扫描团队`) is unchanged across all roster variations so dedup still works regardless of which employees show up in the list.
Test plan
VERSION 0.5.88-dev. No stacking dependency — branches off master directly.
🤖 Generated with Claude Code