Shadow-call intercept: option to follow the conversation's model

Open
#9,096 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
api, backend

Research direction

Start from the shadow-call intercept code path and the ocx models shadow set CLI handler that currently accepts a fixed target; trace how an intercepted helper call selects its model and where intercept_target_unavailable is raised (#5618). Add an opt-in follow-conversation setting there while preserving fixed-target priority, then cover both cases with tests around shadow routing. Done means a helper call from an anthropic/claude-sonnet-5-5 thread is answered by that model when enabled, while a set fixed target and its failover behave as before.

Written by the indexing model from the issue text.

Description

enhancement proxy
Area

Proxy and routing

What are you trying to accomplish?

I use Claude models in Codex App. The app sends its title and activity-summary helper calls to a hardcoded gpt-6-luna. When my OpenAI quota is used up, these calls fail and the thread keeps the first user message as its title. I want these helper calls to use the model of the conversation they belong to.

What prevents this today?

The shadow-call intercept can reroute these calls, but it needs one fixed target model, and it is off with an empty target by default. A fixed target also means that GPT chats get their titles from that same model. If the target becomes unavailable, the call fails with 409 intercept_target_unavailable, by design (#5618).

What should OpenCodex do?

With an opt-in setting, an intercepted helper call is routed to the model that the conversation uses. A fixed target (or a combo with its own failover) keeps priority when it is set. Behaviour for unavailable fixed targets stays unchanged.

Example usage or interface
ocx models shadow set --follow-conversation on

The flag name is only an illustration. Result: a helper call from a thread using anthropic/claude-sonnet-5-5 is answered by that model instead of gpt-6-luna.

Alternatives or workarounds

ocx models shadow set anthropic/claude-haiku-5-5 --enabled on works but uses one model for all conversations.

Additional context

In my local ocx logs there are 49 responses with 429 and 16 with 502 or 504, and about half of my recent Claude threads show the raw first message as title. Related: #2157, #5618, #4129.

Checks
  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.
Dominant language
TypeScript
Stars
16.9k
Forks
1.3k
Avg merge
1d 4h
Merged PRs (30d)
814

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lidge-jun/opencodex

All issues in lidge-jun/opencodex

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.