[WRONG BRANCH] fix(opencode-go): bound replayed tool promotion - #470
[WRONG BRANCH] fix(opencode-go): bound replayed tool promotion#470luvs01 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b75da6e7dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const currentTurnStart = Number.isFinite(replayPrefixLength) | ||
| ? Math.min(body.input.length, Math.max(0, Math.trunc(replayPrefixLength))) | ||
| : 0; |
There was a problem hiding this comment.
Keep the replay boundary aligned after stateless repairs
When a replay prefix contains a dangling function call before an additional_tools item, the OpenCode Go stateless path first runs repairOrphanedInputItems at src/adapters/openai-responses.ts:2387-2389, inserting a synthetic output and shifting that historical wrapper right while _replayPrefixLen remains unchanged. This index comparison then treats a wrapper shifted to the boundary as current and promotes its tools, leaving the historical-tool authority bug reachable; carry or adjust the provenance through length-changing transforms, or normalize before them.
AGENTS.md reference: src/AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
Motivation
additional_toolsdeclaration from expanded continuation input into the top-leveltoolscatalog, which allowed historical (replayed) hosted tools to be treated as current-turn authority._replayPrefixLen), and canonical OpenCode Go requests default to explicit stateless replay, making the regression exploitable on continuation-cache hits.Description
replayPrefixLengthparameter tonormalizeOpenCodeGoAdditionalToolsand compute acurrentTurnStartboundary so onlyadditional_toolsat or after the replay boundary are promoted to the top-leveltoolsarray. (src/adapters/opencode-go-additional-tools.ts).parsed._replayPrefixLen) when calling the normalizer from the Responses passthrough adapter so the helper can distinguish historical wrappers. (src/adapters/openai-responses.ts).additional_toolsrestored from history are removed but not promoted when the current request supplies an explicit empty catalog. (tests/providers/opencode-go-grok46-responses.test.ts)._replayPrefixLeninto the adapter test harness.Testing
bun test tests/providers/opencode-go-grok46-responses.test.ts(39 passed, 0 failed).bun run typecheck(passed).bun run privacy:scan(passed).Codex Task