Skip to content

feat: switch conversation profiles through model router - #1565

Open
malhotra5 wants to merge 3 commits into
mainfrom
switch-profile-model-router
Open

malhotra5 wants to merge 3 commits into
mainfrom
switch-profile-model-router

Conversation

@malhotra5

@malhotra5 malhotra5 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

This pull request was created by an AI agent (OpenHands) on behalf of the user.

Summary

  • Switch /api/v1/app-conversations/{conversation_id}/switch_profile from direct agent-server /switch_llm forwarding to the model-router route flow.
  • Upsert a content-addressed sandbox profile snapshot before adding/selecting the route so edited profiles get fresh registry slots while repeated switches reuse the same route.
  • Preserve app-server profile resolution, provider-connection detachment, customer gateway binding, and conversation llm_model persistence.
  • Update unit tests for profile-save, route-add, route-reuse, and manual model-router selection behavior.

Flow

switch_profile
  resolve app-server saved profile
  detach provider connection
  bind customer gateway config
  save /api/profiles/{profile-content-hash}
  GET /api/conversations/{id}/model_router
  POST /api/conversations/{id}/model_router/routes  (when route is missing)
  PATCH /api/conversations/{id}/model_router         (manual route selection)

Validation

  • uv run ruff format openhands/app_server/app_conversation/app_conversation_router.py tests/unit/app_server/test_app_conversation_router.py
  • uv run ruff check openhands/app_server/app_conversation/app_conversation_router.py tests/unit/app_server/test_app_conversation_router.py
  • uv run pytest tests/unit/app_server/test_app_conversation_router.py -q — 100 passed

@malhotra5 can click here to continue refining the PR


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-0784cc2

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  openhands/app_server/app_conversation
  app_conversation_router.py
Project Total  

This report was generated by python-coverage-comment-action

@malhotra5 malhotra5 changed the title Switch conversation profiles through model router feat: switch conversation profiles through model router Nov 28, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions github-actions Bot added the type: feat A new feature label Nov 28, 2026
Co-authored-by: openhands <openhands@all-hands.dev>

malhotra5 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member Author

This PR update was created by an AI agent (OpenHands) on behalf of the user.

Added Cloud/Enterprise app-server wrappers for conversation-scoped configuration attachment:

  • POST /api/v1/app-conversations/{conversation_id}/secrets
    • accepts existing secret_names resolved server-side from personal/org-accessible secrets
    • accepts inline secrets and forwards them only to the running conversation without persisting them
  • POST /api/v1/app-conversations/{conversation_id}/mcp
    • accepts existing mcp_server_names resolved from effective user settings
    • accepts inline mcp_servers and forwards them only to the running conversation without persisting them
  • Both endpoints reuse the existing agent-server /api/conversations/{id}/secrets and /api/conversations/{id}/mcp APIs with session auth.

Validation run:

  • OPENHANDS_SUPPRESS_BANNER=1 .venv/bin/python -m pytest tests/unit/app_server/test_app_conversation_router.py -q
  • .venv/bin/pre-commit run --config ./dev_config/python/.pre-commit-config.yaml

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants