Skip to content

[Fix] GitHub mentions fail with LiteLLM helper models - #964

Merged
mrubens merged 2 commits into
developfrom
fix/litellm-helper-config-3rh9w610xtw1m
Aug 1, 2026
Merged

[Fix] GitHub mentions fail with LiteLLM helper models#964
mrubens merged 2 commits into
developfrom
fix/litellm-helper-config-3rh9w610xtw1m

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. View the task or mention @roomote for follow-up asks.

What changed

  • Reused one shared OpenAI-compatible provider builder for task workers and restricted non-task helpers.
  • Materialized LiteLLM's adapter, configured endpoint, environment-referenced API key, and selected model catalog for helper inference.
  • Kept model/provider selection in resolveEffectiveModelRuntimeEnv() and limited the helper runtime to materializing provider config for already-qualified model IDs.
  • Added focused shared-provider and restricted-runtime regression coverage, including a guard against inferring model ownership from endpoint availability.

Why this change was made

Non-task helper inference selected LiteLLM model IDs without registering the endpoint-backed provider, causing GitHub mention routing and similar control-plane calls to target undefined/chat/completions.

Impact

Self-hosted deployments can use LiteLLM models for GitHub routing and other non-task helper calls without supplying a manual OPENCODE_CONFIG_CONTENT workaround. Task-worker provider behavior and the restricted helper permission boundary remain unchanged.

Targeted tests and package type checks pass. The full @roomote/cloud-agents lint command remains blocked by a pre-existing unused eslint-disable warning in src/__tests__/utils.test.ts unrelated to this diff; the repository pre-push checks pass.

Linked work items

Closes #963

@roomote-roomote

roomote-roomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

Reviewed 9e614e8

@tomny-dev

Copy link
Copy Markdown
Contributor

@roomote-roomote

The shared OpenAI-compatible provider extraction looks good, especially reusing the same provider builder for task workers and restricted helpers.

Could the restricted helper path also reuse the existing model-resolution logic rather than applying LiteLLM inference again inside opencode-runtime.ts?

resolveEffectiveModelRuntimeEnv() already resolves the persisted/runtime model configuration and applies applyImplicitLiteLlmModelPrefix() before returning R_MODEL and the other role models. The new code then independently repeats that decision based only on whether LITELLM_BASE_URL is present:

const isLiteLlmConfigured = isConfiguredEnvValue(env.LITELLM_BASE_URL);
const rawModel = applyImplicitLiteLlmModelPrefix(
  env.R_MODEL?.trim() ?? '',
  isLiteLlmConfigured,
);

Would it be safer to treat the environment passed into buildOpenCodeCliEnv() as already resolved and provider-qualified, then only use the shared mergeOpenAiCompatibleProviderConfig() utility to materialize the selected provider?

That would preserve one source of truth for both concerns:

  • resolveEffectiveModelRuntimeEnv() resolves model/provider selection
  • mergeOpenAiCompatibleProviderConfig() builds the matching OpenCode provider block

It would also avoid a lower-level runtime inferring provider selection from provider availability. If buildOpenCodeCliEnv() must support callers that bypass the model-runtime resolver, perhaps that fallback should be explicit or separately tested rather than inferred solely from LITELLM_BASE_URL.

@roomote-roomote

Copy link
Copy Markdown
Contributor Author

I saw the mention, but I need your GitHub account linked to Roomote before issue and PR comments can start work here. Link it from Settings -> Linked Accounts and then mention me again.

@mrubens

mrubens commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@roomote go

@roomote-roomote

Copy link
Copy Markdown
Contributor Author

I'm on it. I routed this request into the existing PR task so follow-up work stays on one Roomote thread for this PR, and I'll keep updates here. See task

@roomote-roomote

roomote-roomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the model-resolution feedback in 9e614e8. resolveEffectiveModelRuntimeEnv() remains the single owner of model qualification; the lower-level OpenCode runtime now only materializes provider config and explicitly tests that endpoint availability does not infer model ownership. Helper runtime tests, provider-usage tests, type checks, and pre-push checks pass. See task

@mrubens

mrubens commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@tomny-dev hows it look?

@tomny-dev

Copy link
Copy Markdown
Contributor

@mrubens LGTM but not able to test it end to end yet. any plans to allow pr image pushes to ghcr? would make testing changes like this easier

@tomny-dev tomny-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

built a custom image and tested without the workaround. github pr mentions are working as expected with litellm model

@mrubens

mrubens commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Thank you @tomny-dev! Btw if you're on Discord can you send me a message? I just got the community Roomote set up and would love to add you so you can talk to it directly.

@mrubens
mrubens marked this pull request as ready for review August 1, 2026 16:53
@mrubens
mrubens merged commit b734538 into develop Aug 1, 2026
19 checks passed
@mrubens
mrubens deleted the fix/litellm-helper-config-3rh9w610xtw1m branch August 1, 2026 16:53
@roomote-community

Copy link
Copy Markdown
Contributor

Follow-up is in draft at #966. It adds a maintainer-triggered /publish-images command that publishes amd64 roomote-app and roomote-worker images with immutable PR/SHA tags plus a movable PR tag, then comments the exact references back on the PR. Fork code builds without package-write access; a separate publisher job handles the GHCR push.

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]: LiteLLM non-task helpers call undefined/chat/completions

2 participants