Skip to content

fix(opencode): expose skills in TUI slash command autocomplete - #19

Merged
Leoyzen merged 3 commits into
develop/agenticfrom
fix/opencode-skill-autocomplete
Apr 18, 2026
Merged

fix(opencode): expose skills in TUI slash command autocomplete#19
Leoyzen merged 3 commits into
develop/agenticfrom
fix/opencode-skill-autocomplete

Conversation

@Leoyzen

@Leoyzen Leoyzen commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator

Skills were returned with source='skill' from GET /command, but the OpenCode TUI autocomplete explicitly filters out source==='skill' commands (autocomplete.tsx:363). Native OpenCode's oh-my-openagent plugin injects skills with source='command', bypassing the filter.

Changes:

  • Change skill command source from 'skill' to 'command' in GET /command endpoint (agent_routes.py) to match native OpenCode behavior
  • Expand Command model to match native SDK Command.Info type: add agent, model, subtask, hints fields; make description and source optional
  • Add _extract_hints() helper to extract / placeholders from skill templates, matching native Command.hints() utility
  • Fix server.py CommandStore update: replace broken add_commands() call with register_command(cmd, replace=True) loop
  • Add fallback skill lookup via pool.skill_commands in session_routes when CommandStore misses dynamically-added skills

Skills were returned with source='skill' from GET /command, but the
OpenCode TUI autocomplete explicitly filters out source==='skill'
commands (autocomplete.tsx:363). Native OpenCode's oh-my-openagent
plugin injects skills with source='command', bypassing the filter.

Changes:
- Change skill command source from 'skill' to 'command' in GET /command
  endpoint (agent_routes.py) to match native OpenCode behavior
- Expand Command model to match native SDK Command.Info type: add agent,
  model, subtask, hints fields; make description and source optional
- Add _extract_hints() helper to extract / placeholders
  from skill templates, matching native Command.hints() utility
- Fix server.py CommandStore update: replace broken add_commands() call
  with register_command(cmd, replace=True) loop
- Add fallback skill lookup via pool.skill_commands in session_routes
  when CommandStore misses dynamically-added skills

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the Command model to align with the OpenCode SDK, adding fields for agent, model, subtask, and hints. It introduces a utility to extract input hints from command templates and implements a fallback mechanism in the execution route for skills not yet synchronized with the CommandStore. Feedback includes a suggestion to use numerical sorting for numbered hints to avoid lexicographical ordering issues and a recommendation to handle the 'skill:' prefix in the new fallback logic to ensure consistency with the execution handler.

Comment thread src/agentpool_server/opencode_server/routes/agent_routes.py Outdated
# Fallback: check pool.skill_commands directly when CommandStore misses
# This handles cases where skills were registered after CommandStore init
# or where the CommandStore sync callback hasn't fired yet
if state.pool.skill_commands and request.command in state.pool.skill_commands:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The fallback check does not account for the skill: prefix, which is supported by _execute_skill_command. If a user manually enters a command with the prefix and it hasn't been synced to the CommandStore yet, this fallback will fail to identify it as a skill command. Normalizing the command name ensures consistency with the execution logic.

    cmd_name = request.command.removeprefix("skill:")
    if state.pool.skill_commands and cmd_name in state.pool.skill_commands:

Lexicographical sort produces $1, $10, $2 for double-digit
placeholders; numeric sort yields the expected $1, $2, $10.
@Leoyzen

Leoyzen commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request aligns the Command model with the OpenCode SDK by adding fields for agents, models, subtasks, and input hints. It introduces a hint extraction utility and a fallback mechanism in the command execution route to handle skills that might not be present in the CommandStore. The review feedback recommends making the hint extraction more robust against null inputs and ensuring the command execution fallback correctly handles prefixed command names for consistency.

Comment thread src/agentpool_server/opencode_server/routes/agent_routes.py Outdated
# Fallback: check pool.skill_commands directly when CommandStore misses
# This handles cases where skills were registered after CommandStore init
# or where the CommandStore sync callback hasn't fired yet
if state.pool.skill_commands and request.command in state.pool.skill_commands:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The fallback check for skill_commands should handle the skill: prefix for consistency with how commands are resolved in _execute_skill_command. If a user manually enters a command with the prefix, this check would currently fail even if the skill exists in the registry.

    cmd_name = request.command.removeprefix("skill:")
    if state.pool.skill_commands and cmd_name in state.pool.skill_commands:

…lify with extend

Accept Gemini Code Assist review suggestion: add early-return guard
for None/empty template (defensive against provider bugs returning
None) and replace for-append loop with extend for conciseness.

Add test for None input case.
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