Skip to content

Conversation

@IgorWarzocha
Copy link
Owner

@IgorWarzocha IgorWarzocha commented Jan 3, 2026

  • Enhanced Subagent Interaction: The TUI now allows direct prompting within subagent sessions by removing the parentID visibility restriction, enabling more fluid user interaction with subagents.
  • New /finished Command: A new built-in command, /finished, has been introduced for subsessions. Executing this command triggers an immediate summary generation within the subagent, which is then automatically injected as a new prompt into the parent session, notifying the user of task completion.
  • Subagent Session Management Commands: Two new commands, /wipe and /wipeout, have been added. /wipe allows for the termination and removal of an idle subagent session, while /wipeout enables the termination of all idle subagent sessions from a parent session, both with appropriate navigation and user feedback.
  • Dynamic Configuration Updates: The application now includes new event handlers for config.updated and skill.updated events, ensuring that agents, commands, and configuration data are automatically refreshed when changes occur, improving system reactivity. (unsure why this is here tbh)

@gemini-code-assist
Copy link

Summary of Changes

Hello @IgorWarzocha, 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 significantly enhances the workflow for subagent sessions by enabling direct user interaction within them and introducing a dedicated /finished command. This command streamlines the process of completing subtasks, automatically generating a summary of the subagent's work and communicating it back to the parent session, thereby improving multi-agent coordination and user experience.

Highlights

  • Subagent Prompting: Enabled direct prompting within subagent sessions in the TUI by removing the parentID visibility restriction, allowing users to interact more freely with subagents.
  • New /finished Command: Introduced a new built-in command, /finished, specifically for subsessions to signal completion of their assigned tasks.
  • Automated Summary Generation: Executing the /finished command, either via autocomplete or manually, triggers an immediate summary generation within the subagent.
  • Parent Session Notification: The summary generated by the subagent is automatically injected as a new prompt into the parent session, notifying the user of the subtask's completion and providing the summary.
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.

Copy link

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

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 new /finished command for subagent sessions, which is a great addition for managing subtasks. The implementation enables prompting in subagent TUI sessions and correctly handles injecting the summary back into the parent session. The code is generally well-structured. However, I've identified a copy-paste error in one of the files where a command registration block is duplicated, which should be removed.

@IgorWarzocha
Copy link
Owner Author

/opencode review this. suggest changes

@opencode-agent
Copy link

opencode-agent bot commented Jan 3, 2026

Changes made:

  1. Removed duplicate command registration (lines 387-410) - eliminated the redundant copy-paste error
  2. Added conditional visibility to "Finish subtask" command - now only shows in subsessions (disabled: !session()?.parentID)

These changes ensure:

  • No code duplication
  • "Finish subtask" only appears in the command dialog when actually in a subsession, preventing confusion for users in primary sessions
  • Consistency with the autocomplete behavior where /finished only shows when s.parentID exists

New%20session%20-%202026-01-03T22%3A45%3A22.494Z
opencode session  |  github run

OpenCode Agent added 6 commits January 4, 2026 12:13
Expand AGENTS.md with comprehensive coding and operational protocols.
Implement logic to terminate subagent sessions and notify parents, while
preventing the removal of primary sessions.
Replace the 'kill' command with 'wipe' to remove an idle subagent
session. Add 'wipeout' to remove all idle subagent sessions at once.
Delete obsolete agent and command definitions in .opencode.
- replace existing /kill with /wipe (idle subagents only, no parent notification)
- add /wipeout to delete all idle child sessions from parent
- fix race condition by navigating before deletion in TUI
- update app.tsx to navigate to parent session on deletion
- improve autocomplete logic to prevent duplicate commands and handle session status
@IgorWarzocha
Copy link
Owner Author

/oc verify core opencode functionality is still intact. removal of /unshare was a bit weird. assess implementation of /wipe and /wipeout. analyse the edge cases it might introduce.

@opencode-agent
Copy link

opencode-agent bot commented Jan 4, 2026

Analysis Report

/unshare Status: NOT REMOVED ⚠️

The /unshare command is still present in the codebase:

  • Keybind: packages/opencode/src/config/config.ts:523
  • Implementation: packages/opencode/src/session/index.ts:247
  • UI command: packages/opencode/src/cli/cmd/tui/routes/session/index.tsx:456
  • Autocomplete: packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx:313
  • Tips: packages/opencode/src/cli/cmd/tui/component/tips.ts:85

This was likely an oversight if removal was intended.

/wipe and /wipeout Implementation Analysis

/wipe (src/session/prompt.ts:1368-1382):

  • Only works on subagent sessions (throws "Cannot wipe primary sessions")
  • Only works when idle (throws "Cannot wipe session while busy")
  • No confirmation dialog
  • Returns early with no message to user
  • Critical: TUI navigates to parent BEFORE deletion to avoid race condition

/wipeout (src/session/prompt.ts:1385-1397):

  • Works from parent sessions
  • Deletes ALL idle child sessions recursively
  • Has confirmation dialog in TUI
  • Returns no message to user

Edge Cases & Concerns

  1. No feedback after /wipe execution - Users won't know if it succeeded
  2. Race condition when viewing child during /wipeout - Child sessions being viewed will just show blank UI
  3. Orphaned tool metadata - Tool parts referencing wiped sessions remain in parent messages
  4. No cleanup of subagent state - Pending subagent tool results may be orphaned
  5. Missing event for completed wipes - No way to track when wipes finish
  6. Potential navigation loop - If /wipe fails after navigation, user stuck on wrong session
  7. No transaction safety - If /wipeout partially fails, some children remain in inconsistent state

Recommendations

  1. Add success toast after /wipe and /wipeout
  2. Add confirmation dialog for /wipe (same as /wipeout)
  3. Handle orphaned tool parts when sessions are wiped
  4. Add "session.wiped" event for tracking
  5. Implement transaction rollback for /wipeout failures
  6. Verify /unshare removal intent or update documentation

New%20session%20-%202026-01-04T12%3A19%3A38.818Z
opencode session  |  github run

@IgorWarzocha
Copy link
Owner Author

/gemini summary

@gemini-code-assist
Copy link

Summary of Changes

This pull request significantly enhances the user experience and management capabilities for subagent sessions within the TUI. It introduces direct user prompting in subagent contexts, alongside new commands to streamline the completion and termination of subtasks. These changes aim to improve the efficiency of multi-agent workflows and provide clearer communication between subagents and parent sessions, while also updating internal development guidelines and cleaning up old configuration files.

Highlights

  • Enhanced Subagent Interaction: The TUI now allows direct prompting within subagent sessions by removing the parentID visibility restriction, enabling more fluid user interaction with subagents.
  • New /finished Command: A new built-in command, /finished, has been introduced for subsessions. Executing this command triggers an immediate summary generation within the subagent, which is then automatically injected as a new prompt into the parent session, notifying the user of task completion.
  • Subagent Session Management Commands: Two new commands, /wipe and /wipeout, have been added. /wipe allows for the termination and removal of an idle subagent session, while /wipeout enables the termination of all idle subagent sessions from a parent session, both with appropriate navigation and user feedback.
  • Dynamic Configuration Updates: The application now includes new event handlers for config.updated and skill.updated events, ensuring that agents, commands, and configuration data are automatically refreshed when changes occur, improving system reactivity.
  • Agent Development Guidelines: The AGENTS.md file has been significantly updated to provide comprehensive guidelines for agent development, covering commands, coding standards, tool usage, and workflow, establishing clearer protocols for contributors.
  • Cleanup of .opencode Configuration Files: Several .opencode configuration files, including agent definitions, commands, and tools, have been removed, indicating a potential refactoring or simplification of the project's internal configuration structure.
Changelog
  • .gitignore
    • Added .opencode/ to the ignore list, preventing local .opencode configurations from being committed.
  • .opencode/agent/docs.md
    • Removed the docs.md agent definition.
  • .opencode/agent/triage.md
    • Removed the triage.md agent definition.
  • .opencode/command/commit.md
    • Removed the commit.md command definition.
  • .opencode/command/issues.md
    • Removed the issues.md command definition.
  • .opencode/command/rmslop.md
    • Removed the rmslop.md command definition.
  • .opencode/command/spellcheck.md
    • Removed the spellcheck.md command definition.
  • .opencode/env.d.ts
    • Removed the env.d.ts declaration file.
  • .opencode/opencode.jsonc
    • Removed the opencode.jsonc configuration file.
  • .opencode/skill/test-skill/SKILL.md
    • Removed the SKILL.md test skill definition.
  • .opencode/themes/mytheme.json
    • Removed the mytheme.json theme definition.
  • .opencode/tool/github-triage.ts
    • Removed the github-triage.ts tool implementation.
  • .opencode/tool/github-triage.txt
    • Removed the github-triage.txt tool description.
  • AGENTS.md
    • Replaced existing bullet points with a comprehensive 'Agent Development Guidelines' document, detailing commands, coding standards, type system rules, tool usage, and workflow.
  • packages/app/src/context/global-sync.tsx
    • Introduced a createClient helper function to centralize createOpencodeClient instantiation.
    • Refactored bootstrapInstance and lsp.updated to use the new createClient function.
    • Added new event handlers for config.updated and skill.updated to automatically refresh agents, commands, and configuration data.
  • packages/opencode/src/cli/cmd/tui/app.tsx
    • Modified session deletion logic to navigate to the parent session if a subsession is deleted, instead of always returning to home.
    • Removed the !session().parentID condition for prompt visibility, allowing prompts to be displayed within subagent sessions.
  • packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
    • Filtered out finished, wipe, and wipeout commands from the general autocomplete list.
    • Added /finished and /wipe commands to autocomplete specifically when in a subsession and the subsession is idle.
    • Added /wipeout command to autocomplete for parent sessions that have idle child sessions.
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
    • Imported Identifier for message IDs.
    • Added new command handlers for session.finished, session.wipe, and session.wipeout to the command palette.
    • Implemented session.finished to trigger the /finished command in the subsession.
    • Implemented session.wipe to delete a subsession, navigate to its parent, and show a success toast.
    • Implemented session.wipeout to delete all idle child sessions after user confirmation, and show a success toast.
    • Removed the !session().parentID condition from prompt visibility, enabling prompts in subagent sessions.
    • Modified the Task component's onClick handler to check for session existence before navigating, displaying a toast if the session was wiped.
  • packages/opencode/src/command/index.ts
    • Added FINISHED, WIPE, and WIPEOUT constants to Command.Default.
    • Defined new default commands: finished (summarizes work), wipe (terminates subsession), and wipeout (terminates idle subsessions).
  • packages/opencode/src/session/prompt.ts
    • Implemented the core logic for the /wipe command, including checks for parent sessions and idle status before removal.
    • Implemented the core logic for the /wipeout command, which identifies and removes all idle child sessions.
    • Added post-command processing for /finished: if executed in a subsession, it extracts the summary and injects it as a new prompt into the parent session.
Activity
  • gemini-code-assist[bot] provided an initial summary of the PR's changes, highlighting subagent prompting, the new /finished command, automated summary generation, and parent session notification.
  • IgorWarzocha requested a review and suggestions for changes from the /opencode agent.
  • opencode-agent[bot] made changes, specifically removing a duplicate command registration and adding conditional visibility for the 'Finish subtask' command in the TUI, ensuring it only appears in subsessions.
  • IgorWarzocha requested verification of core functionality, assessment of /wipe and /wipeout implementations, and analysis of potential edge cases.
  • opencode-agent[bot] provided a detailed analysis report, confirming /unshare was not removed, detailing the behavior of /wipe and /wipeout, and outlining several edge cases and concerns (e.g., no feedback after /wipe, race conditions, orphaned tool metadata, missing events, potential navigation loops, and lack of transaction safety). The bot also provided recommendations for improvements.

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.

2 participants