Skip to content

Fix compute module startup by loading OpenRouter key from Sources#17

Merged
anand-testcompare merged 2 commits intomainfrom
fix/openrouter-source-credentials
Feb 14, 2026
Merged

Fix compute module startup by loading OpenRouter key from Sources#17
anand-testcompare merged 2 commits intomainfrom
fix/openrouter-source-credentials

Conversation

@anand-testcompare
Copy link
Collaborator

@anand-testcompare anand-testcompare commented Feb 14, 2026

Why

Compute module replicas were failing to start because the app requires OPENROUTER_API_KEY at FastAPI lifespan startup.

What changed

  • Read OpenRouter API key from compute module Sources via SOURCE_CREDENTIALS (supports additionalSecretOpenRouterApiKey and apiKey).
  • Keep DSPY_PROVIDER=local as the explicit escape hatch.
  • Enable Palantir MCP tools in opencode.jsonc so Foundry source/egress setup can be automated.

Summary by CodeRabbit

  • New Features

    • Added OpenCode Palantir integration configuration to control agent behaviors, tool access, Foundry URL/token handling, and discovery-focused agent modes.
    • Added support for resolving OpenRouter API keys from stored credential sources as an alternative to environment variables.
  • Improvements

    • Improved error messaging and LLM provider handling (including OpenRouter model name normalization) for clearer configuration feedback.

Load OpenRouter API key from compute module SOURCE_CREDENTIALS (additionalSecretOpenRouterApiKey) so FastAPI lifespan can configure DSPy LM in Foundry.
@railway-app railway-app bot temporarily deployed to dspy-reference-example / dspy-reference-examples-pr-17 February 14, 2026 21:18 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 14, 2026

🚅 Deployed to the dspy-reference-examples-pr-17 environment in dspy-reference-example

Service Status Web Updated (UTC)
dspy-reference-examples ✅ Success (View Logs) Web Feb 14, 2026 at 10:33 pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Walkthrough

Adds an OpenCode Palantir integration configuration file and extends LLM configuration to load OpenRouter API keys from a SOURCE_CREDENTIALS JSON file (with env fallback), prefixing OpenRouter model names when needed and binding the resolved API key into LLM config.

Changes

Cohort / File(s) Summary
OpenCode Palantir Integration
opencode.jsonc
New configuration defining plugin/model/tool toggles for Palantir, mcp entry for palantir-mcp (local command + FOUNDLY token env), two agents (foundry-librarian, foundry) with detailed tool whitelists/blacklists, and Foundry API URL/token handling.
Credential and Config Handling
src/common/config.py
Added internal helpers to read JSON credentials from SOURCE_CREDENTIALS, resolve OPENROUTER_API_KEY from credential sources (with configurable source/field precedence) and environment, updated load_llm_config to use the resolved key and prefix OpenRouter model names with openrouter/ when missing.

Poem

🐇 A little rabbit hops the wire,
Found tokens tucked and keys afire,
Two agents sniff the documentation trail,
Configs aligned — a tidy tale,
Hooray for neat config bits and bytes!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: loading the OpenRouter API key from Sources to fix compute module startup. It directly addresses the primary objective and is specific to the core fix.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/openrouter-source-credentials

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
opencode.jsonc (1)

62-62: Consider whether get_or_create_network_egress_policy belongs in the librarian agent.

The foundry-librarian agent is described as focused on "exploration and context gathering" with write operations disabled. However, get_or_create_network_egress_policy can create network egress policies, not just read them. If the intent is to keep this agent read-only, consider setting this to false for the librarian and keeping it enabled only for the execution agent.


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

Replace hardcoded Foundry instance URL with {env:FOUNDRY_URL} to avoid committing tenant-specific values.
@railway-app railway-app bot temporarily deployed to dspy-reference-example / dspy-reference-examples-pr-17 February 14, 2026 22:32 Destroyed
@anand-testcompare anand-testcompare merged commit 757f855 into main Feb 14, 2026
8 checks passed
@anand-testcompare anand-testcompare deleted the fix/openrouter-source-credentials branch February 14, 2026 22:37
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