Skip to content

fix(responses): recover native MESSAGE history without losing turn scope - #3690

Merged
lidge-jun merged 9 commits into
devfrom
codex/a-03-recovery
Sep 5, 2026
Merged

fix(responses): recover native MESSAGE history without losing turn scope#3690
lidge-jun merged 9 commits into
devfrom
codex/a-03-recovery

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

Carry #3568 so opted-in routed subagents can recover supported native MESSAGE envelopes and reuse previously admitted recovery for replayed history. Historical cache lookup revalidates existing caller/envelope admission and neither starts another recovery nor extends plaintext lifetime. Canonical non-forward OpenCode Go requests translate supported plaintext agent messages to public Responses messages.

Recovery reparsing also retains the conversation termination binding, so replaying a delivered final answer does not manufacture another provider request while a genuine user follow-up still runs.

All three original voiys commits are preserved, including the destination and forward-auth documentation corrections. Catalog/effort work stays in #3571. This is partial progress for #3661; multipart envelopes and other residual recovery failures are outside this change.

Stack (merge bottom-up):

Layer PR Review focus
0 — foundation #3696 Deterministic Windows shutdown verification
1 #3683 SSE failure termination
2 #3686 WS outbound routing
3 — this PR carries #3568 Native MESSAGE recovery and cache replay
4 — planned source #3581 Command Code affinity
5 — planned source #3671 Effective capabilities

Depends on #3686. Review this layer's diff only.

Verification

  • Independent refreshed plan audit passed; original source and author preserved with -x provenance.
  • Added cache exact-expiry/byte-accounting, destination/forward exclusions, mixed-history handler and real Kiro final-answer replay/user-follow-up regressions. Pinned remote execution passed.
  • No local suite, typecheck or build executed, per maintainer instruction.
  • Exact head 332a30e6d3a6cb3941acbf68df0656df3778c731, pinned remote Bun 1.4.0: 96 tests passed, 0 failed, typecheck passed; documentation build passed with 425 pages.
  • Removing the reparse scope rebind makes the new final-replay regression send an unwanted provider request; candidate restored afterwards.
  • Same independent reviewer rechecked the corrected scope binding and all four changed files: implementation/security PASS, zero blockers.
  • Full current-head CI including Windows was superseded before completion: https://github.com/lidge-jun/opencodex/actions/runs/33979215486 . PR remains draft until required gates pass.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Co-authored-by: voiys matej2714@gmail.com

Verification update: the additional manual full-CI run on this pre-repair head was cancelled after existing Windows shutdown-spill fixture defects were identified. Normal PR verification and captured logs are retained. A separate deterministic fixture repair will be inserted beneath the stack; required CI will be rerun on refreshed heads before admin merge. No passing full-Windows claim is made.

Current stack verification: head 608565f15c498d5762fab225629b7e7234770bbd, base codex/a-02-ws. Foundation #3696 is included; all five layer diffs are byte-identical to their independently reviewed pre-foundation diffs, and original contributor commits remain ancestors. Prior focused results above are pre-restack evidence. Current-head full CI: https://github.com/lidge-jun/opencodex/actions/runs/33981582675 . Required completion is pending; admin merge remains bottom-up.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

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

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 60 / 80

이 PR은 옵트인 routed 서브에이전트가 지원되는 native MESSAGE 봉투를 복구하고, 이미 허용된 recovery를 재생 히스토리에 재사용하게 합니다. 원본 #3568 carry이고, 이슈 #3661(encrypted agent task / recovery)의 부분 진행입니다. 스택은 #3696#3683#3686이 PR#3692#3694입니다. base는 codex/a-02-ws라서 지금 dev에 단독 머지할 수 없습니다.

핵심은 (1) cachedAgentTaskRecovery로 캐시 hit 시 새 recovery를 시작하지 않고 lifetime도 연장하지 않기, (2) OpenCode Go non-forward 요청에서 plaintext agent_message를 public Responses message로 번역하는 src/adapters/opencode-go.ts 신규 모듈, (3) recovery reparse가 conversation termination binding을 유지해 delivered final answer 재생이 추가 provider 요청을 만들지 않기입니다. multipart·잔여 recovery 실패는 범위 밖이라고 명시합니다. 지금 checkout에는 opencode-go 어댑터 파일이 없고 transport leaf만 있어, 이 PR이 어댑터 헬퍼를 새로 넣는 형태가 맞습니다.

#3661을 한 방에 닫지 않는 정직한 범위입니다. Go 서브에이전트·recovery 재생 회귀와 layout 등록이 있습니다. draft·상위 base 의존·Windows full CI가 남아 있습니다.

경로/심볼 src/adapters/opencode-go.ts normalizeOpenCodeGoAgentMessages - plaintext input_text/image/file만 message로 올리고, ciphertext·unknown part는 기존 fail-closed를 유지합니다.

경로/심볼 cachedAgentTaskRecovery - 만료면 삭제 후 null, hit면 assignment만 반환. 재요청·TTL 연장을 하지 않습니다.

경로 openai-responses passthrough - !forward && isOpenCodeGo(baseUrl)일 때만 normalize. forward/auth 경로는 그대로입니다.

경로 원본 #3568 / 이슈 #3661 - #3568은 랜딩 후 landed 닫기. #3661은 partial이라 열린 채 두고 남은 envelope 작업을 이어서 적으세요.

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

너의 추천
스택 순서대로 아래층(#3696/#3683/#3686) CI 통과 후 이 층 리뷰·머지. 단독 dev 머지 금지. 머지 후 #3568 landed 닫기, #3661은 partial 기록만.

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

@lidge-jun
lidge-jun changed the base branch from codex/a-02-ws to dev September 5, 2026 18:31
@lidge-jun
lidge-jun marked this pull request as ready for review September 5, 2026 18:31
@lidge-jun

Copy link
Copy Markdown
Owner Author

Owner-authorized admin merge of #3690, carrying #3568 with original contributor commits and attribution preserved.

Exact head: 608565f. All functional producers in full cross-platform run https://github.com/lidge-jun/opencodex/actions/runs/33981582675 succeeded, including all Linux/macOS/Windows suite jobs, unsharded macOS control, type/privacy gates and platform smokes. Any remaining queued ci aggregation is evaluated directly by its success/skipped allowlist; no unexecuted tests or failures are bypassed.

Independent implementation/security review passed. Foundation restacking preserved the complete layer diff byte-for-byte and retained original contributor commits. Child retargeting precedes auto-deletion. Final dev inclusion will be checked immediately after merge.

Co-authored-by: voiys matej2714@gmail.com

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 5, 2026 18:31
@lidge-jun
lidge-jun merged commit 6e15dad into dev Sep 5, 2026
53 of 78 checks passed
@lidge-jun
lidge-jun deleted the codex/a-03-recovery branch September 5, 2026 18:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T18:33:11.125150Z 608565f Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

3 participants