Skip to content

feat(droid): wire OAuth proxy via customModels + fix subscription gate#74

Open
twaldin wants to merge 2 commits intomainfrom
flt/droid-oauth-fixer
Open

feat(droid): wire OAuth proxy via customModels + fix subscription gate#74
twaldin wants to merge 2 commits intomainfrom
flt/droid-oauth-fixer

Conversation

@twaldin
Copy link
Copy Markdown
Owner

@twaldin twaldin commented May 7, 2026

Summary

  • Root cause fixed: plain model slugs (gpt-5.5 etc.) in droid session settings trigger the factory.ai subscription gate. The custom: prefix signals BYO-provider mode and skips the check entirely.
  • toCustomModelId() in src/adapters/droid.ts: converts a bare slug → custom:{slug}-0 (droid auto-assigns this ID to unique entries in customModels). Already-prefixed IDs pass through unchanged.
  • ~/.factory/settings.json (local, not in repo): populated with customModels entries for GPT-5.5, GPT-5.4, GPT-5.4-Mini, GPT-5.3-Codex all pointing at the OAuth proxy (http://127.0.0.1:10531/v1).
  • src/model-resolution.ts: droid added to BARE_MODEL_HARNESSES; alias mappings added for cc-opus→gpt-5.5, cc-sonnet→gpt-5.4, cc-haiku→gpt-5.4-mini, pi-coder→gpt-5.3-codex, pi-deep→gpt-5.5.
  • ~/.flt/presets.json (local, not in repo): droid-coder, droid-deep, droid-mini, droid-reviewer presets added.
  • All 28 model-resolution unit tests pass.

How it works

  1. droid reads ~/.factory/settings.json and assigns each customModels entry an id custom:{model_slug}-0
  2. flt writes a per-session settings file with model: "custom:gpt-5.4-0" (via toCustomModelId)
  3. droid sees the custom: prefix → BYO mode → uses the entry's baseUrl (http://127.0.0.1:10531/v1) and apiKey: "unused" → OAuth proxy → ChatGPT Codex backend

Test plan

  • Start codex-oauth proxy (codex-oauth start or equivalent)
  • flt spawn droid-coder in a worktree — confirm droid opens with GPT-5.4 and responds without subscription error
  • flt spawn droid-deep — confirm GPT-5.5 works
  • flt spawn droid-mini — confirm GPT-5.4-mini works
  • Alias: flt spawn --cli droid --model cc-sonnet → resolves to gpt-5.4 → custom:gpt-5.4-0

🤖 Generated with Claude Code

twaldin and others added 2 commits May 6, 2026 16:42
The droid adapter used 'custom:gpt-5.4-(codex-oauth-proxy)-0' as its
default model ID — an old format generated by droid's interactive UI
that requires a matching customModels entry in ~/.factory/settings.json.
No such entry exists, causing droid to fall back to factory.ai's billed
Opus 4.7 model instead of routing through the local OAuth proxy.

Fix: use direct model slugs (e.g. 'gpt-5.4'). Droid honors OPENAI_BASE_URL
for routing when given a plain slug, and the adapter already injects
OPENAI_BASE_URL=http://127.0.0.1:10531/v1 + OPENAI_API_KEY=unused.
Verified by the running data-detective session which uses 'gpt-5.5' this way.

Also:
- Add 'droid' to BARE_MODEL_HARNESSES (strips openai/ prefix)
- Add droid entries to all cross-CLI aliases (cc-opus→gpt-5.5,
  cc-sonnet→gpt-5.4, cc-haiku→gpt-5.4-mini, pi-coder→gpt-5.3-codex,
  pi-deep→gpt-5.5)
- Remove dead 'factory-droid' model resolution path (adapter is
  registered as 'droid'; the factory-droid custom:-prefix logic
  was never reachable)
- Update tests to cover new droid alias mappings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Plain model slugs (gpt-5.5, etc.) cause droid to treat the model as
factory-hosted and fail with "No active subscription found". Custom model
entries in ~/.factory/settings.json get `custom:{slug}-0` IDs which signal
BYO-provider mode and skip the subscription check entirely.

- Add toCustomModelId() helper: converts slug → custom:{slug}-0 (droid's
  auto-assigned ID format for unique per-slug entries)
- Session settings now write custom: prefixed IDs so droid routes through
  the customModels entry's baseUrl (the OAuth proxy) instead of factory.ai

Note: ~/.factory/settings.json customModels must be populated with the GPT
subscription models pointing at the OAuth proxy (done separately).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Warning

Rate limit exceeded

@twaldin has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 32 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48092655-f788-44d2-acd6-fe9906f810cd

📥 Commits

Reviewing files that changed from the base of the PR and between 5218c18 and 933199a.

📒 Files selected for processing (3)
  • src/adapters/droid.ts
  • src/model-resolution.ts
  • tests/unit/model-resolution.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch flt/droid-oauth-fixer

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 and usage tips.

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