fix(sidebar): attach subagent children to sessions rendered inside slug groups - #134
Merged
Conversation
JeanBaptisteRenard
added a commit
that referenced
this pull request
Aug 21, 2026
Review finding F1 on PR #134 (reviewer-r1-deliverable.md): nesting the subagent's caret/children as DOM siblings inside a slug group means group.querySelectorAll('.session-item') in the "Archive all sessions in group" handler now also matches the nested subagent item (its className includes session-item for shared styling), so archiveSession/stopSession were reached with a subagent id. Apply the same :not([data-subagent]) guard already used elsewhere in this file. Adds a 4th test to dom-slug-group-subagent-nesting.test.js pinning the fix (archive-all on a group with an attached subagent only reaches the two top-level ids) — confirmed failing without the guard, restored.
JeanBaptisteRenard
enabled auto-merge (squash)
August 21, 2026 14:07
…ug groups buildSlugGroup() appended its sessions via the raw buildSessionItem(session), never through appendSubagentChildren — only the ungrouped top-level render path called that helper. Any session rendered inside a slug group (e.g. a schedule rerun sharing a slug with an earlier run, the only real producer of grouped top-level sessions) silently lost its subagent caret/children, and because the group <div> carries no dataset.sessionId, the orphan-subagents pass in buildSessionsList didn't recognize the grouped session as accounted for either, duplicating its subagents into the "Orphan subagents" bucket. appendSubagentChildren() is hoisted to module scope so buildSlugGroup can call it per session, and a new collectTopLevelSessionIds() walks into a group element for the orphan-detection pass. Adds test/dom-slug-group-subagent-nesting.test.js, seeded with the exact session_cache row shape schedule-runner.js:createScheduleSession() produces for two reruns of the same schedule — confirmed failing on both assertions before the fix, per rehab-plan.md A3+A4. Refs #128 (Part 2 of the cleanup plan)
Review finding F1 on PR #134 (reviewer-r1-deliverable.md): nesting the subagent's caret/children as DOM siblings inside a slug group means group.querySelectorAll('.session-item') in the "Archive all sessions in group" handler now also matches the nested subagent item (its className includes session-item for shared styling), so archiveSession/stopSession were reached with a subagent id. Apply the same :not([data-subagent]) guard already used elsewhere in this file. Adds a 4th test to dom-slug-group-subagent-nesting.test.js pinning the fix (archive-all on a group with an attached subagent only reaches the two top-level ids) — confirmed failing without the guard, restored.
devsuitup
force-pushed
the
fix/slug-group-subagent-nesting
branch
from
August 23, 2026 20:25
97e639b to
4e80273
Compare
…subagent nesting Adversarial review of #134 found appendSubagentChildren called from three sites in buildSlugGroup (promoted / rest-under-more / no-active-session), with only the promoted branch actually exercised by a test with a subagent child. Add the two missing fixtures; mutation-tested by removing each call in turn (restored afterward).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildSlugGroup()appended its sessions via the rawbuildSessionItem(session), never throughappendSubagentChildren— only the ungrouped top-level render path called that helper. Any session rendered inside a slug group (e.g. a schedule rerun sharing a slug with an earlier run — the only real producer of grouped top-level sessions, seeschedule-runner.js:createScheduleSession()) silently lost its subagent caret/children.<div>carries nodataset.sessionIdof its own, so the "orphan subagents" pass inbuildSessionsListnever counted a grouped session's id as accounted-for either — its subagents were duplicated into the project's "Orphan subagents" bucket.appendSubagentChildren()is hoisted from a closure insiderenderProjects()to module scope (it never captured any of that function's locals) sobuildSlugGroup(slug, sessions, subagentIndex)can call it per rendered session, and a newcollectTopLevelSessionIds(el)walks into a group element for the orphan-detection pass..ai/contexts/subagent-observability.md(new section); the code carries only one-line pointers to it.This is PR 2 of the slug-grouping rehab plan (
.work-files/switchboard/slug-grouping-investigation/rehab-plan.md, Option A: A3 nesting fix + A4 first real test of schedule-rerun grouping). PR 1 (A1+A2, dead plan-accept detection cleanup) is separate.Test plan
test/dom-slug-group-subagent-nesting.test.js: seeds two top-level sessions sharing a slug in the exactsession_cacherow shapeschedule-runner.js:createScheduleSession()produces for two reruns of the same schedule, plus a subagent parented to one of them.Fix1morphdom fixtures intest/dom-sidebar-perf.test.jsthat usebuildSlugGroup's output as a stateful-DOM fixture still pass unmodified (only the internal signature changed; they exercise it throughrenderProjects, not directly).task check(lint + full suite): 580 passed, 1 pre-existing skip, 0 failures.Refs #128 (Part 2 of the cleanup plan)