feat(agent-core): replace asChild boolean with an explicit session role enum - #451
Merged
WinterYukky merged 2 commits intoAug 24, 2026
Conversation
…Session tool Replace the binary asChild parameter with a three-value role enum: - 'child': Sub-task of the current session (replaces asChild=true) - 'successor': Hand over to a fresh parent session, re-parenting the current session and all its children under the new one - 'independent': Completely separate session (replaces asChild=false) The successor role enables session handover (引き継ぎ): when an agent's context grows too large or the user explicitly requests a handover, it can spin up a fresh coordinator that inherits the full session tree. Supporting changes: - Add reparentSessions() to sessions.ts with cycle detection, self-parent guard, and DDB TransactWrite (bounded at 100 items) - Add sessionReparented webapp event for real-time sidebar updates - Add handedOverTo field to SessionItem schema (idempotency guard for concurrent handover attempts)
The tool description and role guidance are user-facing prompt strings in the public upstream, so remove the stray non-English term and keep the handover wording consistent in English. No behavioural change (8 tests pass).
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
Replace the boolean
asChildparameter of the createNewSession tool with anexplicit
roleenum (child|successor|independent), and add thesession-reparenting plumbing the
successorrole needs.Motivation
A single boolean could not express the three distinct relationships a new session
can have with the current one. An explicit enum makes intent unambiguous in the
tool schema, enables the successor/handover flow (re-parent the current session
and its children under a fresh parent), and keeps independent sessions clearly
separate.
Changes
asChildfor theroleenum; expand the tool description and role guidance.reparentSessionsto move a setof child workers under a new parent.
event types for the role + reparenting.
Testing
(tsc + prettier + vitest).
Notes
successorflow introduced here — merge this first.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.