Skip to content

fix(team): kill all members on team done/blocked - #611

Merged
namastex888 merged 1 commit into
devfrom
exit-fix
Mar 16, 2026
Merged

namastex888 merged 1 commit into
devfrom
exit-fix

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

Summary

  • genie team done <name> and genie team blocked <name> now kill all team member processes after setting status
  • Reuses killWorkersByName() from disbandTeam() — same mechanism, without deleting worktree/config
  • Fixes infinite idle loop where team-lead keeps running after lifecycle is complete

Changes

  • src/lib/team-manager.ts: Added killTeamMembers() — iterates team members and kills each via killWorkersByName()
  • src/term-commands/team.ts: done and blocked handlers now call killTeamMembers() after setTeamStatus()

Test plan

  • bun run typecheck passes
  • bun run lint passes
  • bun test — 736 tests pass
  • bun run build — builds successfully
  • Manual: genie team done <name> sets status to done AND kills all agent processes
  • Manual: genie team blocked <name> sets status to blocked AND kills all agent processes
  • Verify team config file still exists after done/blocked (not deleted)

…ked`

Previously these commands only updated the config file status — the team-lead
and other agents kept running in an infinite idle loop. Now both commands
call killTeamMembers() to terminate all worker processes after setting status,
reusing the same killWorkersByName() pattern from disbandTeam().
@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8191e3f3-fc22-49c3-9bfa-eef0573e4a0c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch exit-fix
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the team management commands by ensuring that all active worker processes associated with a team are properly terminated when the team's status is marked as 'done' or 'blocked'. This prevents orphaned processes and addresses a bug where team-leads could remain active after their intended lifecycle, improving resource management and system stability.

Highlights

  • Process Termination: The genie team done <name> and genie team blocked <name> commands now automatically terminate all associated team member processes after updating the team's status.
  • Code Reusability: The new process killing mechanism reuses the killWorkersByName() function, similar to how disbandTeam() operates, but without deleting the worktree or configuration.
  • Bug Fix: This change resolves an issue where team-lead processes could continue running indefinitely, leading to an infinite idle loop even after the team's lifecycle was complete.
Changelog
  • src/lib/team-manager.ts
    • Added a new asynchronous function killTeamMembers to iterate through a team's members and terminate their running worker processes using killWorkersByName.
  • src/term-commands/team.ts
    • Modified the done command handler to call killTeamMembers after setting the team status to 'done'.
    • Modified the blocked command handler to call killTeamMembers after setting the team status to 'blocked'.
    • Updated the descriptions for the done and blocked commands to reflect the new behavior of killing team members.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix to ensure that when a team is marked as 'done' or 'blocked', all its member processes are terminated. This is achieved by adding a new killTeamMembers function in team-manager.ts and calling it from the done and blocked commands in team.ts. The changes are logical and effectively address the issue of lingering processes. I've suggested a small performance improvement to parallelize the worker termination process.

Comment thread src/lib/team-manager.ts
Comment on lines +434 to +440
for (const member of config.members) {
try {
await killWorkersByName(member);
} catch {
// Best-effort — continue with other members
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For improved efficiency, you can parallelize killing the team members' workers using Promise.all. This will initiate all kill operations concurrently rather than sequentially, preventing a delay in killing one worker from blocking the others.

Suggested change
for (const member of config.members) {
try {
await killWorkersByName(member);
} catch {
// Best-effort — continue with other members
}
}
await Promise.all(
config.members.map((member) =>
killWorkersByName(member).catch(() => {
// Best-effort — continue with other members
}),
),
);

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f076c51e95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/team-manager.ts

for (const member of config.members) {
try {
await killWorkersByName(member);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope member shutdown to the target team

Calling killWorkersByName(member) here can terminate workers from other teams because team memberships store generic role names (e.g. engineer, reviewer) and killWorkersByName matches globally on w.role === agentName || w.id === agentName rather than filtering by w.team; after this commit, running genie team done <name> or blocked <name> will now kill same-role agents in unrelated active teams.

Useful? React with 👍 / 👎.

@namastex888
namastex888 merged commit d504e7e into dev Mar 16, 2026
6 checks passed
@namastex888
namastex888 deleted the exit-fix branch March 29, 2026 22:10
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