Skip to content

fix: /debate command now manages debate workflow directly (#231)#237

Merged
avifenesh merged 11 commits intomainfrom
fix/debate-command-231
Feb 19, 2026
Merged

fix: /debate command now manages debate workflow directly (#231)#237
avifenesh merged 11 commits intomainfrom
fix/debate-command-231

Conversation

@avifenesh
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes bug: /debate command delegates to debate-orchestrator agent instead of managing the debate itself #231: The /debate command was delegating ALL orchestration to the debate-orchestrator agent via a single Task() call, instead of managing the workflow directly
  • Rewrote /debate Phase 3 to execute the debate inline: invoke Skill: debate for templates, call Skill: consult per round (proposer + challenger), synthesize verdict, save state
  • Repositioned debate-orchestrator agent as the programmatic entry point for other agents/workflows that need to spawn debates via Task() — mirrors how consult-agent relates to /consult
  • Synced OpenCode and Codex adapters; ran gen-adapters to keep them fresh
  • Updated tests to validate the new inline execution architecture

Architecture Change

Before (broken):

/debate command → Task(debate:debate-orchestrator) → does everything

After (correct, matches /consult pattern):

/debate command → Skill: debate (templates) → Skill: consult per round → verdict → state
debate-orchestrator agent = programmatic entry point for Task() callers

Test Plan

  • 78 debate-command tests pass, including command does not spawn debate-orchestrator via Task
  • 4019 total tests pass (0 failures)
  • npx agentsys-dev validate passes (13 plugins, 42 agents, 28 skills)
  • npx agentsys-dev preflight --all passes (13/13 checks)
  • 3 review loop iterations completed (0 critical, 0 high issues)
  • /enhance run on all modified agents, commands, and skills

…delegating to orchestrator agent

Move debate orchestration logic (skill invocation, round execution, verdict
synthesis, state saving) from debate-orchestrator agent into the /debate
command itself, following the /consult pattern.

The debate-orchestrator agent is now the programmatic entry point for other
agents/workflows that need to spawn debates via Task(). Direct user
invocations use the command path.

Syncs OpenCode and Codex adapters.

Fixes #231
The /debate command was refactored from delegating to debate-orchestrator
to executing the debate workflow inline (Skill: debate + Skill: consult
per round). Update 4 tests that checked for the old spawn pattern:

- command spawns debate:debate-orchestrator -> invokes skills inline
- command invokes skill via Task tool in Phase 3 -> Skill blocks in Phase 3
- command handles orchestrator failure -> handles tool failure during debate
- orchestrator description mentions proposer/challenger -> programmatic entry point
…, least-privilege tools

- Add inline failure-handling directives in Phase 3b round loop across
  all 3 command files (plugin, opencode adapter, codex adapter) for both
  proposer and challenger consult invocations
- Remove Task from allowed-tools in plugin command (least-privilege;
  command uses Skill: directly, not Task)
- Strengthen test assertion for command/agent skill reference
- Add negative regression test ensuring command does not spawn
  debate-orchestrator via Task
- Add test for Skill in allowed-tools, add negative test for Task removal
- Add Challenger fails round 1 check to error handling test
- Remove duplicate skill version test from alignment block (kept in
  cross-file consistency block)
… sanitization test

- Update Error Handling table in all 3 command files to match the inline
  Phase 3b challenger failure message exactly:
  `[WARN] Challenger ({tool}) failed on round 1. Proceeding with uncontested proposer position.`
- Add "MUST sanitize all tool output before displaying" constraint to all 3
  command files (already present in orchestrator agent, now ported to commands)
- Add test verifying command has Output Sanitization section
Add unreleased entry for /debate command inline orchestration refactor.
…r phrases

- debate-orchestrator: capabilities-focused description replacing "Programmatic entry point..." wording
- debate-orchestrator: simplify Role section triad paragraph to two-line summary
- adapters/codex/skills/debate/SKILL.md: add missing version and argument-hint fields
- adapters/opencode/commands/debate.md: add missing name field to frontmatter
- debate command (plugins + opencode): add trigger phrases to description for better command routing
Copilot AI review requested due to automatic review settings February 19, 2026 23:05
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @avifenesh, 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 refactors the internal architecture of the /debate command. Instead of relying on a separate orchestrator agent to manage the entire debate process, the command now directly handles the workflow by invoking specific skills for template loading, round execution, verdict synthesis, and state management. This change streamlines the command's operation, improves control over the debate flow, and redefines the debate-orchestrator agent's role as a programmatic interface for other agents, enhancing modularity and consistency across similar command patterns.

Highlights

  • Refactored /debate command architecture: The /debate command now directly manages the debate workflow (parse, resolve, execute, verdict) using Skill invocations, rather than delegating the entire process to the debate-orchestrator agent via a single Task() call. This aligns its behavior with the /consult command.
  • Repositioned debate-orchestrator agent: The debate-orchestrator agent is now designated as the programmatic entry point for other agents or workflows that need to initiate a structured debate via Task(), serving a similar role to how consult-agent relates to /consult.
  • Detailed inline debate execution: Phase 3 of the /debate command has been rewritten to explicitly detail the steps for executing a debate inline, including loading debate templates, executing rounds by invoking Skill: consult for proposer and challenger, synthesizing a verdict, and saving the debate state.
  • Updated documentation and tests: The CHANGELOG.md and README.md files have been updated to reflect the new architecture. Comprehensive tests in debate-command.test.js were modified and added to validate the inline execution and ensure the command no longer spawns the orchestrator via Task().
  • Adapter synchronization: OpenCode and Codex adapters for the debate command and orchestrator agent were synced, and gen-adapters was run to ensure consistency.
Changelog
Activity
  • 78 debate-command tests passed, including a specific test confirming the command does not spawn debate-orchestrator via Task.
  • A total of 4019 tests passed with 0 failures across the project.
  • npx agentsys-dev validate successfully passed for 13 plugins, 42 agents, and 28 skills.
  • npx agentsys-dev preflight --all passed all 13 checks.
  • 3 review loop iterations were completed with no critical or high issues identified.
  • The /enhance command was run on all modified agents, commands, and skills.
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
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1352c45ed1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… CI test

The test 'orchestrator description describes programmatic entry point' asserts
the agent description contains /programmatic/i and /Task()/. The description
had 'Task()' but was missing 'programmatic'. Updated to: 'Programmatic entry
point for other agents or workflows that need to spawn a structured debate via
Task().'
Update adapters/opencode/agents/debate-orchestrator.md description to match
the updated plugins/debate/agents/debate-orchestrator.md description, keeping
both files in sync as required by the adapter-freshness check.
…-tools

Without Bash(claude:*), Bash(gemini:*) etc., all Skill: consult calls in
the debate command would fail at runtime since skills execute within the
command's tool permission scope.
Copy link
Copy Markdown
Collaborator Author

@avifenesh avifenesh left a comment

Choose a reason for hiding this comment

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

Fixed in the latest commit. Added Bash(claude:), Bash(gemini:), Bash(codex:), Bash(opencode:), Bash(copilot:), Bash(git:) to allowed-tools in the /debate command, matching the permissions previously held by the debate-orchestrator agent and mirroring the /consult command's tool scope.

Copy link
Copy Markdown

@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

The pull request successfully transitions the /debate command from a delegated orchestration model (using Task()) to an inline orchestration model (using Skill: debate and Skill: consult). This change aligns /debate with the pattern used by /consult, improving consistency and control. The debate-orchestrator agent is correctly repositioned as a programmatic entry point for other workflows. The updates to the adapters and tests are thorough. I have identified a few minor inconsistencies in placeholder naming and logic for round-based summarization that should be addressed for better agent reliability.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes /debate orchestration by moving Phase 3 execution into the /debate command itself (matching the /consult pattern), while repositioning debate-orchestrator as a programmatic Task() entry point for other workflows.

Changes:

  • Rewires /debate Phase 3 to run rounds inline via Skill: debate (templates) + Skill: consult (per-round tool calls), then synthesize verdict and save state.
  • Updates debate-orchestrator agent copy to describe programmatic spawning via Task() instead of /debate.
  • Syncs OpenCode/Codex adapter docs and updates tests/README/CHANGELOG accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
plugins/debate/commands/debate.md Removes Task delegation; documents inline debate execution, verdict synthesis, state saving, and sanitization guidance.
plugins/debate/agents/debate-orchestrator.md Reframes orchestrator as a Task()-spawned programmatic entry point (not /debate-spawned).
adapters/opencode/commands/debate.md Syncs OpenCode adapter command with the new inline execution architecture.
adapters/opencode/agents/debate-orchestrator.md Syncs OpenCode adapter agent description with new programmatic spawning role.
adapters/codex/skills/debate/SKILL.md Syncs Codex adapter debate spec text to reflect inline execution approach.
tests/debate-command.test.js Updates assertions to validate inline Skill execution and least-privilege (no Task) behavior.
README.md Updates /debate one-line description in the generated commands table.
CHANGELOG.md Adds an Unreleased “Fixed” entry for issue #231.
package-lock.json Lockfile metadata changes consistent with regeneration/update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…tribution, process.env wording, stale agent references

- Replace {N} with {round} in round display headers (proposer and challenger) for consistency
- Fix context assembly rule: "rounds 1 through N-2" -> "rounds 1 through {round}-2" to correctly refer to current round
- Correct sk-proj-* attribution: it is an OpenAI project key, not an Anthropic key
- Replace process.env.AI_STATE_DIR with plain English "AI_STATE_DIR environment variable" in Phase 3d
- Update debate-orchestrator agent: replace "pre-resolved by the /debate command" with "pre-resolved by the caller" and fix error message to match
- Regenerate OpenCode and Codex adapter files via gen-adapters.js
@avifenesh
Copy link
Copy Markdown
Collaborator Author

The Bash tool permissions issue has been addressed in commit 55f06bd, which added Bash(claude:), Bash(gemini:), Bash(codex:), Bash(opencode:), Bash(copilot:), and Bash(git:) to the /debate command's allowed-tools frontmatter.

@avifenesh avifenesh merged commit 5504b15 into main Feb 19, 2026
6 checks passed
@avifenesh avifenesh deleted the fix/debate-command-231 branch February 19, 2026 23:24
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fac294230e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +164 to +165
Skill: debate
Args: "[topic]" --proposer=[proposer] --challenger=[challenger] --rounds=[rounds] --effort=[effort]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid self-invoking the Codex debate skill

In the Codex adapter, this file is itself the debate skill (name: debate at the top), but Phase 3a now tells the runtime to invoke Skill: debate; because there is no separate debate-template skill in adapters/codex/skills/, this resolves back to the same skill and can recurse instead of loading templates, which blocks /debate execution on Codex installs. This was introduced by replacing the prior Task-based flow with an inline Skill: debate call.

Useful? React with 👍 / 👎.

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.

bug: /debate command delegates to debate-orchestrator agent instead of managing the debate itself

2 participants