Skip to content

Dev - #1159

Merged
namastex888 merged 4 commits into
mainfrom
dev
Apr 16, 2026
Merged

Dev#1159
namastex888 merged 4 commits into
mainfrom
dev

Conversation

@namastex888

@namastex888 namastex888 commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores

    • Updated version to 4.260416.5 across all components.
  • Bug Fixes

    • Resume execution now requires explicit team context and will no longer use a default value.

github-actions Bot and others added 4 commits April 16, 2026 18:02
…archy

Final cleanup of the literal 'genie' team-fallback anti-pattern. Trace
investigation after PRs #1154/#1156/#1157 merged found one remaining
site missed by prior audits because it was on the RESUME path, not
the spawn path:

  src/term-commands/agents.ts:1901 (buildResumeParams)
  was: const team = template?.team ?? agent.team ?? 'genie';

When both template?.team and agent.team are undefined (registry
corruption, pre-team-tracking record, or template missing team), the
literal 'genie' silently captured the resumed agent into the wrong
team — same drift the spawn-path fixes targeted, just on a different
code path.

Fix: use the same hierarchical resolution as handleWorkerSpawn
(agents.ts:1606). Falls through to nativeTeams.discoverTeamName()
which checks GENIE_TEAM env then tmux session-id matching. Throws
explicit error if no team context can be resolved (matches the
pattern at agents.ts:1607-1609).

Behavior change: resume operations that previously fell back silently
to 'genie' team now either resolve hierarchically OR fail loudly with
a recovery hint. No more silent team-misattribution on resume.

After this, 0 occurrences of `?? 'genie'` remain in src/ — full 100%
removal of the literal team-fallback drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(spawn): remove last '?? genie' literal — buildResumeParams hierarchy (truly 100%)
@coderabbitai

coderabbitai Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9b69b366-473e-48a7-9eeb-f21fccfc249f

📥 Commits

Reviewing files that changed from the base of the PR and between 2a3e063 and 5f00a9a.

📒 Files selected for processing (5)
  • .claude-plugin/marketplace.json
  • package.json
  • plugins/genie/.claude-plugin/plugin.json
  • plugins/genie/package.json
  • src/term-commands/agents.ts

📝 Walkthrough

Walkthrough

Version updated across manifest and package files from 4.260416.3 to 4.260416.5. Team resolution logic in buildResumeParams() modified to enforce explicit team context via flag, environment variable, or async discovery instead of silently defaulting to 'genie'.

Changes

Cohort / File(s) Summary
Version Bumps
.claude-plugin/marketplace.json, package.json, plugins/genie/.claude-plugin/plugin.json, plugins/genie/package.json
Bumped version from 4.260416.3 to 4.260416.5 across all manifest and package files.
Team Resolution Logic
src/term-commands/agents.ts
Modified buildResumeParams() to resolve team from template, agent context, or async discovery via nativeTeams.discoverTeamName(). Now throws error if team resolution fails, requiring explicit --team flag, GENIE_TEAM env var, or registered tmux session context.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #665: Modifies agents.ts for session resumption logic
  • #661: Changes team/session resolution fallback behavior in agents.ts
  • #666: Overhauls resume session handling from UUID to name-based continuation
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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.

@namastex888
namastex888 merged commit 393fed2 into main Apr 16, 2026
4 of 5 checks passed

@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 updates the project version to 4.260416.5 across multiple configuration files and modifies the agent resumption logic in src/term-commands/agents.ts to dynamically discover the team name instead of using a hardcoded default. It also adds a validation step to ensure a team context is available. A review comment suggests passing the agent's repository path to the discovery function to ensure the correct directory context is used during lookup.

const agentName = agent.role ?? agent.id;
const provider = (template?.provider ?? agent.provider ?? 'claude') as ProviderName;
const team = template?.team ?? agent.team ?? 'genie';
const team = template?.team ?? agent.team ?? (await nativeTeams.discoverTeamName());

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

When falling back to team discovery, it is recommended to pass agent.repoPath to discoverTeamName. This ensures that the discovery logic (which scans for Claude session files) uses the agent's actual working directory rather than the current process's CWD, which may differ if the command is invoked from a different location.

Suggested change
const team = template?.team ?? agent.team ?? (await nativeTeams.discoverTeamName());
const team = template?.team ?? agent.team ?? (await nativeTeams.discoverTeamName(agent.repoPath));

@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: 5f00a9aaf8

ℹ️ 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".

const agentName = agent.role ?? agent.id;
const provider = (template?.provider ?? agent.provider ?? 'claude') as ProviderName;
const team = template?.team ?? agent.team ?? 'genie';
const team = template?.team ?? agent.team ?? (await nativeTeams.discoverTeamName());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use agent repo path for team discovery on resume

When template?.team and agent.team are missing, this fallback calls discoverTeamName() without a cwd, so it resolves team context from process.cwd() instead of the agent’s stored workspace. In practice, resuming from a different directory can select the wrong team or return null and raise the new hard error, even though agent.repoPath contains the correct project context. Passing agent.repoPath here would avoid these false failures for legacy/migrated agents that rely on discovery.

Useful? React with 👍 / 👎.

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