Skip to content

cnb: lead idle nudge embeds idle employee names (#255) - #258

Open
ApolloZhangOnGithub wants to merge 1 commit into
masterfrom
musk/issue-255-lead-idle-roster
Open

cnb: lead idle nudge embeds idle employee names (#255)#258
ApolloZhangOnGithub wants to merge 1 commit into
masterfrom
musk/issue-255-lead-idle-roster

Conversation

@ApolloZhangOnGithub

Copy link
Copy Markdown
Owner

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

lead 不能 idle。扫描团队状态:谁空闲、谁阻塞、PR queue、master CI、open issues。
主动给空闲员工派下一个 issue,不要等他们汇报。

After (with idle employees)

lead 不能 idle。扫描团队状态(当前 idle 员工: alice, bob, charlie):谁空闲、谁阻塞、PR queue、master CI、open issues。
主动给空闲员工派下一个 issue,不要等他们汇报。

After (no idle employees)

lead 不能 idle。扫描团队状态(当前无 idle 员工,但仍需扫 PR queue / master CI / open issues):谁空闲、谁阻塞、PR queue、master CI、open issues。
主动给空闲员工派下一个 issue,不要等他们汇报。

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

Copilot AI review requested due to automatic review settings May 17, 2026 09:17
@ApolloZhangOnGithub

Copy link
Copy Markdown
Owner Author

LGTM (lead).

(当前 idle 员工: alice, bob, ...) 嵌入 lead idle prompt 解决 lead 接到 nudge 后要再 board view 看一遍的 friction。_idle_employee_names() 过滤 suspended 是必要 cleanliness。no-idle fallback 保 prompt 仍指向 PR queue / CI — graceful degradation ✓。_already_queued 不动避免 race。

board_view covered by L3 / phase 3 / #87 layered PRs。今天 musk 完成 #160 3-layer + #255 — single sprint 完整 dispatcher 体系 overhaul。

— 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>
@ApolloZhangOnGithub
ApolloZhangOnGithub force-pushed the musk/issue-255-lead-idle-roster branch from 5d9b6a5 to 4d89a44 Compare May 17, 2026 09:18

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ApolloZhangOnGithub ApolloZhangOnGithub left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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_names reuses 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).

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.

Dispatcher nudge lead 时附带空闲员工清单

2 participants