Skip to content

Fix compact routing and agent_message replay for routed providers - #38

Open
jt-wang wants to merge 1 commit into
architectds:mainfrom
jt-wang:cursor/fix-compact-agent-message
Open

jt-wang wants to merge 1 commit into
architectds:mainfrom
jt-wang:cursor/fix-compact-agent-message

Conversation

@jt-wang

@jt-wang jt-wang commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert Codex agent_message collaboration items to plain user messages before routed upstream replay so Kimi and other non-native backends accept compact histories.
  • Sync modelSelection on every gateway leg, including compact_v2, not only after a normal relay returns client_selected.
  • Prefer the active main model over stale payload.model for compact summarize while still honoring an explicit vision-model compact pick.

Motivation

Long Codex sessions with spawn/collaboration traffic can carry agent_message items that native GPT understands but routed providers reject (item type "agent_message" is not supported). Separately, compact summarize could follow a stale payload.model instead of the model the user currently has selected in the picker.

Test plan

  • Added/updated unit tests in test/gateway.test.mjs and test/subagent-guidance.test.mjs
  • node --test test/gateway.test.mjs test/subagent-guidance.test.mjs (190/190 pass)
  • CI npm test

Made with Cursor

…viders

Convert Codex agent_message items to plain user messages before routed
upstream replay, sync modelSelection on every gateway leg including compact_v2,
and prefer the active main model over stale payload.model while still honoring
an explicit vision-model compact pick.
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