Skip to content

fix(launch-subagent): inherit parent session group by default#1213

Open
petitcl wants to merge 1 commit into
asheshgoplani:mainfrom
petitcl:fix/subagent-inherit-parent-group
Open

fix(launch-subagent): inherit parent session group by default#1213
petitcl wants to merge 1 commit into
asheshgoplani:mainfrom
petitcl:fix/subagent-inherit-parent-group

Conversation

@petitcl
Copy link
Copy Markdown
Contributor

@petitcl petitcl commented May 28, 2026

Problem

When a sub-agent is spawned via launch-subagent.sh from a session that belongs to a specific group, the new session lands in the default group instead. This makes it hard to find the sub-agent alongside its parent in the TUI — they end up in different groups.

Example: parent session is in group "Others", spawned sub-agent lands in "clement.petit" (the profile default).

Root cause

The script already calls agent-deck session current --json, which includes the group field. It reads session, profile, and path from that JSON, but never reads group, so -g is never passed to agent-deck launch.

Fix

Extract the parent session's group from the existing JSON call and pass it to agent-deck launch with -g when present.

+PARENT_GROUP=$(echo "$CURRENT_JSON" | jq -r '.group // empty')
 
 LAUNCH_CMD=(agent-deck -p "$PROFILE" launch "$WORK_DIR" -t "$TITLE" --parent "$PARENT" -c "$TOOL" -m "$PROMPT")
+[ -n "$PARENT_GROUP" ] && LAUNCH_CMD+=(-g "$PARENT_GROUP")

The // empty guard means sessions with no group set are unaffected.

Test plan

  • Spawn a sub-agent from a session in a named group; confirm the sub-agent lands in the same group
  • Spawn a sub-agent from a session with no group; confirm behavior is unchanged

Example of a sub-agent launched from the group "Others" and configured to keep the parent group, vs another agent also launched from "Others", but which doesn't respect the parent group.

Screenshot 2026-05-28 at 12 37 25

Summary by CodeRabbit

  • Features
    • Sub-agent launches now inherit group context from parent sessions, enabling consistent configuration across related agent instances.

Review Change Stack

When a sub-agent is spawned from a session that belongs to a specific
group, the new session would land in the default group instead, making
it hard to find alongside its parent in the TUI.

The script already reads the current session via `agent-deck session
current --json`, which includes the group field. This change extracts
that group and passes it to `agent-deck launch` with `-g`, so sub-agents
are co-located with their parent by default.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

The launch-subagent.sh script is updated to read the parent session's optional group field and, when present, forward it to the child sub-agent launch command via the -g argument, allowing the spawned session to inherit the parent's group context.

Changes

Sub-agent group context

Layer / File(s) Summary
Group context propagation to sub-agent
skills/agent-deck/scripts/launch-subagent.sh
Script extracts the parent session's optional group value from agent-deck session current --json and conditionally appends -g "$PARENT_GROUP" to the child launch command.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A sub-agent takes flight,
Group context shining bright,
Parent passes down the way,
Children inherit, come what may! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(launch-subagent): inherit parent session group by default' directly and clearly describes the main change: making sub-agents inherit their parent session's group, which is exactly what the changeset implements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

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