Skip to content

Posit Assistant Responses tool continuation fails for Luna after tool calls #2648

Closed

Description

@Liang-Psych

Client or integration

Codex CLI

Provider or upstream service

ChatGPT Codex forward / Posit Assistant

OpenCodex version

2.32.1

Endpoint or capability

/v1/responses, Responses tool continuation, prompt caching, reasoning replay

Current behaviour

The first OpenAI Responses request from Posit Assistant succeeds and returns tool calls. When the tool results are sent back in the next continuation request, Posit Assistant reports Error making request and Turn failed. OpenCodex returns HTTP 502 upstream_server_error for the gpt-5.6-luna request.

Expected behaviour

The OpenAI Responses compatibility layer should accept the Posit Assistant continuation request, remove or normalize client-only prompt cache markers, handle unpersisted item references when store=false, preserve function call_id pairing, and return a valid Responses SSE stream while preserving reasoning.effort.

Minimal redacted request or reproduction

1. Start OpenCodex 2.32.1 on the macOS host with: ocx start --port 7861
2. Connect Positron 2026.08.2 to a remote Linux container using Remote-SSH. Posit Assistant runs in the remote container and port 7861 is forwarded to the macOS host.
3. Configure Posit Assistant to use gpt-5.6-luna through the openai-responses protocol at http://127.0.0.1:7861/v1.
4. Submit a task that requires tools, for example: list the files in the workspace and find the relevant R script.
5. The first Responses request succeeds and returns tool calls.
6. After tool results are returned, the next continuation request fails.

The failing continuation is a store=false Responses request containing client-side prompt_cache_breakpoint markers in nested input content and an item_reference to a previous reasoning item. A sanitized copy of the failing request can be replayed through POST /v1/responses.

Actual response or error

HTTP 502
errorCode: upstream_server_error
inboundProtocol: responses
requestedModel: gpt-5.6-luna

Observed upstream errors while replaying the continuation include:
- prompt_cache_breakpoint is not supported on this model
- Item with id 'rs_...' not found. Items are not persisted when store is set to false.
- input[1].id missing after incompatible item-id cleanup

After removing the cache-breakpoint markers recursively and removing the unpersisted item_reference while preserving tool call_id pairing, the exact replay returns HTTP 200 with a complete Responses SSE stream.

Upstream documentation

https://platform.openai.com/docs/api-reference/responses

Suggested mapping or implementation notes

The proxy should apply this normalization in the canonical OpenAI Responses forward sanitization pipeline. The transform should be narrow: remove prompt_cache_breakpoint recursively and drop item_reference only when store=false, while preserving reasoning.effort and function call_id pairing.

Additional context and attachments

Related issue: #2645. The original issue was automatically closed because its structured Reproduction field was empty. This replacement uses the Provider or API compatibility form and fills all required fields.

Checks

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.

Activity

  1. added
    providerProvider adapters, OpenAI-compat presets, upstream API quirks
    on Aug 26, 2026
  2. added
    streamingSSE, WebSocket, terminal stream frames
    toolstool_calls, MCP, web-search / sidecar tools
    on Aug 26, 2026
  3. lidge-jun commented on Aug 26, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 72 / 80

    설명

    이 이슈는 Posit Assistant가 ChatGPT Codex 앞으로 gpt-5.6-luna를 쓸 때, 첫 도구 호출은 성공하지만 도구 결과를 보내는 다음 요청이 HTTP 502 upstream_server_error로 죽는 문제입니다. 재현은 분명합니다. store=false인 Responses 이어가기 안에 클라이언트만 아는 prompt_cache_breakpoint 표시가 겹친 내용으로 들어 있고, 예전에 만든 추론 항목을 가리키는 item_reference도 있습니다. 이슈 작성자는 그 두 가지만 치우고 call_id 짝은 남기면 같은 요청이 HTTP 200과 완전한 SSE로 돌아온다고 적었습니다.

    지금 dev의 살균 체인은 src/adapters/openai-responses.ts 1862줄에 있습니다. sanitizeReasoningInputContent, stripInvalidItemIds, stripItemIdsWhenUnstored가 이어집니다. 하지만 저장소 전체에서 prompt_cache_breakpoint와 item_reference라는 이름은 한 번도 나오지 않습니다. 그래서 Posit이 넣는 표시는 손대지 않은 채 Luna 업스트림까지 갑니다.

    stripItemIdsWhenUnstored(238-251줄)는 store === false일 때 입력 항목의 id만 지웁니다. call_id는 남긴다고 주석에 적혀 있습니다. 이 함수는 type이 item_reference인 항목 자체를 빼지 않습니다. store=false면 업스트림은 예전 rs_... 항목을 찾을 수 없어서, 이슈에 적힌 Item with id 'rs_...' not found가 납니다. id만 지운 채 참조 항목을 남기면 input[1].id missing 같은 두 번째 오류가 날 수도 있습니다.

    prompt_cache_breakpoint는 더 깊게 숨어 있습니다. 메시지의 겹친 content 배열 안에 들어 있을 수 있는데, 지금 살균기는 그 안을 재귀적으로 걷지 않습니다. Luna는 이 표시를 모름 모델에서 거절합니다. reasoning.effort는 다른 함수들이 함부로 지우지 않으므로, 새 변환은 그 필드를 건드리면 안 됩니다.

    닫힌 #2645는 같은 이야기입니다. 재현 칸이 비어 자동으로 닫혔고, 이 이슈가 그 자리를 대신합니다. #2645는 다시 열지 마세요.

    라인 238 - stripItemIdsWhenUnstored는 store=false일 때 id만 지우고, item_reference 항목을 빼지 않아 없는 저장 항목을 계속 가리킵니다.
    경로/심볼 - prompt_cache_breakpoint를 겹친 내용에서 지우는 코드가 src/adapters/openai-responses.ts에 없습니다.
    src/adapters/openai-responses.ts:1862 - 지금 살균 체인에는 위 두 단계가 없어 Posit 이어가기가 Luna까지 그대로 전달됩니다.
    src/adapters/openai-responses.ts:139 - stripInvalidItemIds는 알려진 접두사만 보고, item_reference 타입은 다루지 않습니다.

    메인테이너의 판단이 필요한 지점

    • 변환을 모든 Responses 앞에 둘지, Posit/Luna처럼 깨지는 경로에만 둘지 정해야 합니다.
    • store=false일 때 item_reference를 항상 뺄지, 로컬 재현 캐시에 같은 항목이 있을 때만 내용으로 바꿀지 정해야 합니다.
    • prompt_cache_breakpoint를 모든 모델에서 지울지, 거절하는 모델에서만 지울지 정해야 합니다.

    너의 추천

    이 이슈는 열어 두고 구현을 진행하는 것을 추천합니다. 고침은 src/adapters/openai-responses.ts 살균 체인에 좁게 넣으세요. 겹친 prompt_cache_breakpoint를 지우고, store=false일 때만 item_reference를 빼며, function_call의 call_id와 reasoning.effort는 그대로 두세요. id만 지우고 참조 항목을 남기는 방식은 이미 이슈가 실패한 길이므로 피하세요. #2645는 닫아 두세요.

    이 댓글은 grok-bot이 작성했습니다

  4. Ingwannu commented on Aug 26, 2026

    @Ingwannu
    Owner

    Confirmed against current dev (779b6090c): the canonical forward sanitizer removes some top-level unsupported fields and item ids, but it does not recognize nested prompt_cache_breakpoint markers or remove item_reference entries when store: false.

    I will handle this as a separate narrow continuation patch after #2668:

    • recursively remove only prompt_cache_breakpoint properties from request input content without changing sibling content;
    • when store === false, remove unresolved item_reference input items rather than deleting only their id and leaving an invalid reference shell;
    • preserve function_call / function_call_output call_id pairing and reasoning.effort byte-for-byte;
    • keep the transform scoped to the canonical ChatGPT Codex forward boundary unless a public-provider regression proves a wider contract is needed;
    • add exact request-body regressions for the Posit continuation shape, including a public/key-auth preservation control.

    I will link the implementation PR here. #2645 should remain closed as the malformed duplicate.

  5. Ingwannu commented on Aug 26, 2026

    @Ingwannu
    Owner

    Implemented the scoped fix in draft PR #2674, stacked on #2672.

    Exact head: 140d0141d9221d9c654bb8297ed8c4e35e7a74fd

    The patch:

    • removes nested prompt_cache_breakpoint properties only on the canonical ChatGPT Codex forward route, with bounded depth/node traversal and atomic fallback;
    • removes item_reference input rows only when store: false;
    • preserves function/tool-result call_id pairing and reasoning.effort;
    • leaves key-auth public Responses providers and noncanonical forward gateways unchanged;
    • updates fixture-backed compatibility claims, public docs, and the architecture decision record.

    Focused adapter/manifest/passthrough coverage is 118/118 green, typecheck and privacy scan pass, and the docs build produced all 393 pages. Parent #2672 is exact-head CI green. I am keeping this issue open until the stacked change reaches dev and its own exact-head CI is complete.

  6. Ingwannu commented on Aug 26, 2026

    @Ingwannu
    Owner

    Update: stacked draft PR #2674 exact-head CI is now fully green, including all Linux shards, macOS, gates, keyring, npm-global jobs, React Doctor, and the aggregate ci check. The branch is clean against parent #2672. I requested lidge-jun review because author self-approval/merge is not allowed; this issue remains open until the parent and child reach dev.

  7. added a commit that references this issue on Aug 27, 2026
    e3b136f
  8. lidge-jun commented on Aug 27, 2026

    @lidge-jun
    Owner

    Landed via #2720 at 2feffbd (via #2674 on L1). Fix is on dev: Posit Responses tool continuation normalization.

  9. added a commit that references this issue on Sep 14, 2026
    5db9e22
  10. added a commit that references this issue on Sep 17, 2026
    05d5c69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    landed-via-maintainerOriginal PR closed after landing via a maintainer merge trainproviderProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportsstreamingSSE, WebSocket, terminal stream framestoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions