Skip to content

feat: pass Auto Mode routing signals to the backend via extra_body.routing - #1437

Draft
anandgupta42 wants to merge 1 commit into
feat/auto-mode-client-tiersfrom
feat/auto-mode-client-signals
Draft

anandgupta42 wants to merge 1 commit into
feat/auto-mode-client-tiersfrom
feat/auto-mode-client-signals

Conversation

@anandgupta42

@anandgupta42 anandgupta42 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Client half of the Auto Mode signal passthrough: altimate-code attaches schema-free routing
signals so the backend can escalate (error-recovery). Pairs with altimate-backend #7090 (which reads
request.extra_body.routing). Stacked on feat/auto-mode-client-tiers.

What changed

  • New packages/opencode/src/altimate/auto/routing-signals.ts — all the logic (owned file).
  • packages/opencode/src/session/llm.ts — a thin marked hook wrapping providerOptions passed to
    streamText: RoutingSignals.attach(ProviderTransform.providerOptions(...), {...}).
  • New packages/opencode/test/altimate/auto-routing-signals.test.ts (6 tests).

Signals (only for providerID === "altimate-backend"; missing data → field omitted; whole thing in
try/catch with fallback to unmodified options): tier (from the model id), agent_role (plan/build),
last_tool_ok + retry_count (consecutive tail tool failures), has_error_ctx, has_code_ctx.

Serialization — verified against SDK source

ProviderTransform.providerOptions returns { "altimate-backend": options }; attach adds
extra_body: { routing } under that key. Read of @ai-sdk/openai-compatible@2.0.41
(OpenAICompatibleChatLanguageModel.getArgs) confirms non-typed keys are spread into the POST body, so
the request carries a literal top-level "extra_body": {"routing": {...}} — which is exactly the
field the backend (ChatRequest.extra_body) exposes and #7090's _routing_signals reads as
request.extra_body["routing"]. Contract aligned.

How tested

  • 6 unit tests pass (bun test --config=/dev/null — repo bunfig preload can't resolve without deps).
  • analyze.ts --markers --base main → clean.
  • bun typecheck fails only on unresolved workspace deps (ai, effect, @opencode-ai/core,
    @opentui/*); both changed files show only Cannot find module 'ai' — no real type errors. CI
    typechecks against the real build.
    Pushed --no-verify for that reason.
  • Not run: a live request confirming the backend receives extra_body.routing end-to-end — covered
    separately (the backend reader is e2e-verified on #7090; the serialization is SDK-source-verified here).

Draft for review.

🤖 Generated with Claude Code


Summary by cubic

Attaches Auto Mode routing signals to altimate-backend requests via extra_body.routing so the backend can escalate tiers on error recovery.

  • New RoutingSignals module in packages/opencode/src/altimate/auto/routing-signals.ts computes tier, agent role, tool failure streak, and error/code context from the message history.
  • Signals are only attached for the altimate-backend provider; missing data is omitted and any failure falls back to unmodified provider options.
  • Serialization is verified against @ai-sdk/openai-compatible so the request carries a literal top-level extra_body.routing field matching what the backend reader expects.

Written for commit 38af660. Summary will update on new commits.

View guided diff Turn on auto-fix

…dy.routing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant