Skip to content

fix: correct new_answer argument name in Copilot backend synthetic tool call#863

Closed
Copilot wants to merge 3 commits intocopilot-sdkfrom
copilot/sub-pr-862
Closed

fix: correct new_answer argument name in Copilot backend synthetic tool call#863
Copilot wants to merge 3 commits intocopilot-sdkfrom
copilot/sub-pr-862

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 7, 2026

Description

Fixed parameter mismatch in Copilot backend's fallback mechanism. When the model responds with text but doesn't call workflow tools, the backend synthesizes a new_answer tool call. However, it was using "answer" as the parameter name instead of "content", causing the orchestrator to reject it and retry with "You must use workflow tools" errors.

Type of change

  • Bug fix (fix:) - Non-breaking change which fixes an issue
  • New feature (feat:) - Non-breaking change which adds functionality
  • Breaking change (breaking:) - Fix or feature that would cause existing functionality to not work as expected
  • Documentation (docs:) - Documentation updates
  • Code refactoring (refactor:) - Code changes that neither fix a bug nor add a feature
  • Tests (test:) - Adding missing tests or correcting existing tests
  • Chore (chore:) - Maintenance tasks, dependency updates, etc.
  • Performance improvement (perf:) - Code changes that improve performance
  • Code style (style:) - Changes that do not affect the meaning of the code (formatting, missing semi-colons, etc.)
  • CI/CD (ci:) - Changes to CI/CD configuration files and scripts

Checklist

  • I have run pre-commit on my changed files and all checks pass
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Pre-commit status

check python ast.........................................................Passed
trim trailing whitespace.................................................Passed
Add trailing commas......................................................Passed
isort....................................................................Passed
autoflake................................................................Passed
black....................................................................Passed
flake8...................................................................Passed
Check package with Pyroma................................................Passed

How to Test

Test CLI Command

# Run Copilot backend tests
uv run pytest massgen/tests/backend/test_copilot.py -v

# Test with actual Copilot SDK (requires API key)
uv run massgen --config massgen/configs/basic/single/copilot.yaml "What is the capital of France?"

Expected Results

  • All 3 unit tests pass
  • Simple factual questions receive immediate answers without retry loops
  • Orchestrator correctly processes the synthesized new_answer tool call

Additional context

Root cause: The new_answer tool schema defines content as the required parameter (see massgen/tool/workflow_toolkits/new_answer.py), and the orchestrator extracts it via tool_args.get("content", ...). The synthetic tool call was using the wrong key.

Changes:

  • massgen/backend/copilot.py:310: Changed {"answer": full_answer}{"content": full_answer}
  • massgen/tests/backend/test_copilot.py:129: Updated test assertion to expect correct parameter name
  • Fixed bare except clause to catch specific exceptions (json.JSONDecodeError, ValueError)
  • Added noqa: E402 for intentional post-mock import

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 7, 2026 15:32
…ol call

The Copilot backend's fallback mechanism was using "answer" instead of "content"
as the argument name when synthesizing a new_answer tool call. The new_answer
tool definition expects "content" (as defined in new_answer.py), causing the
orchestrator to retry and fail with "Agent failed to use workflow tools after 3 attempts".

Changed line 311 in copilot.py from:
  "arguments": {"answer": full_answer}
to:
  "arguments": {"content": full_answer}

Also updated test_copilot.py to reflect the correct expected argument name.

Co-authored-by: AbhimanyuAryan <8083613+AbhimanyuAryan@users.noreply.github.com>
Co-authored-by: AbhimanyuAryan <8083613+AbhimanyuAryan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Copilot SDK fix: correct new_answer argument name in Copilot backend synthetic tool call Feb 7, 2026
Copilot AI requested a review from AbhimanyuAryan February 7, 2026 15:35
@github-actions
Copy link
Copy Markdown

This PR is marked as stale because there has been no activity for 30 days. Remove stale label or add new comments or this PR will be closed in 3 day.

@github-actions
Copy link
Copy Markdown

Close this stale PR.

@github-actions github-actions Bot closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants