Skip to content

fix(shadow-call): preserve foreground Luna turns - #885

Closed
kimrinking-cell wants to merge 1 commit into
lidge-jun:devfrom
kimrinking-cell:agent/preserve-foreground-luna-turns
Closed

fix(shadow-call): preserve foreground Luna turns#885
kimrinking-cell wants to merge 1 commit into
lidge-jun:devfrom
kimrinking-cell:agent/preserve-foreground-luna-turns

Conversation

@kimrinking-cell

Copy link
Copy Markdown

Summary

  • Preserve foreground Codex turns when the selected bare model is also listed as a shadow-call source.
  • Use x-codex-turn-metadata.request_kind to bypass interception only for explicit turn requests.
  • Keep the existing opt-in behavior for helper requests, headerless clients, and unknown or malformed metadata.
  • Add regression coverage and document the compatibility boundary.

Root cause

The issue #311 follow-up expanded the default source prefixes to include gpt-5.6-luna. The runtime still classified requests only by model prefix, so a user-selected Luna foreground turn could be rewritten to the configured shadow model and have its reasoning effort forced to low.

Codex 0.145.0 and later project the request purpose through x-codex-turn-metadata. This change uses the explicit request_kind: "turn" signal while preserving the prior all-matching contract when that signal is absent or unrecognized.

Related: #311

Compatibility

  • turn: preserve the requested model and effort.
  • prewarm, compaction, and memory: keep shadow interception.
  • Headerless, malformed, or future unknown metadata: keep the legacy prefix behavior.
  • Routed model ids and non-source models remain unchanged.
  • No config migration or schema change is required.

Smaller UI-only alternative

If maintainers prefer to keep the broad runtime contract unchanged, the smallest mitigation would be a warning/confirmation dialog when enabling Shadow Call Intercept or when a selected foreground model overlaps sourceModels. The dialog should state that matching foreground requests can be redirected and forced to low effort.

That warning would help dashboard users, but it would not protect config-file users or clients that change models later, so this PR keeps the runtime classification fix focused and does not mix in GUI changes.

Verification

Validated locally on macOS only:

  • bun test tests/responses-shadow-intercept.test.ts — 14 passed
  • bun test --isolate tests — 6,964 passed, 8 skipped, 0 failed
  • bun run typecheck
  • bun run privacy:scan
  • cd gui && bun test tests — 493 passed
  • cd gui && bun run lint
  • cd gui && bun run build
  • cd docs-site && bun run build
  • git diff --check

Linux and Windows behavior has not been claimed from local testing; the repository CI matrix should validate those platforms for this commit.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs were updated for the behavior change.
  • No authentication, credential, dependency, or workflow boundary was changed.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f7b1a270-606c-46f2-bcd1-f2d453a035f5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@github-actions github-actions Bot added the bug Something isn't working label Aug 2, 2026
@lidge-jun

Copy link
Copy Markdown
Owner

Landed in #892 as ffc24bc (authorship preserved). The fail-closed semantics (headerless, malformed, or future-unknown metadata all keep legacy prefix interception) passed adversarial review. Closing as superseded — nice, minimal fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants