Skip to content

fix(acp): return invalid params for unsupported session mode#1689

Open
kyzhang-melo wants to merge 1 commit intoMoonshotAI:mainfrom
kyzhang-melo:fix-acp-session-tests
Open

fix(acp): return invalid params for unsupported session mode#1689
kyzhang-melo wants to merge 1 commit intoMoonshotAI:mainfrom
kyzhang-melo:fix-acp-session-tests

Conversation

@kyzhang-melo
Copy link
Copy Markdown

@kyzhang-melo kyzhang-melo commented Apr 1, 2026

Related Issue

None.

Description

This PR improves ACP session mode validation in set_session_mode.

Previously, unsupported mode_id values were rejected with an assert, which could surface as a generic internal error path. This change aligns set_session_mode with the existing ACP handler style used in nearby methods such as set_session_model, by returning structured acp.RequestError.invalid_params(...) errors instead.

Changes:

  • return invalid_params when mode_id != "default"

  • return invalid_params when session_id does not exist

  • add ACP protocol tests for:

    • unsupported session mode
    • unknown session id

Validation:

  • uv run pytest tests/acp/test_protocol_v1.py -q
  • make format
  • make check

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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