[codex] Preserve command identity across repeated approvals#30969
Open
bookholt-oai wants to merge 11 commits into
Open
[codex] Preserve command identity across repeated approvals#30969bookholt-oai wants to merge 11 commits into
bookholt-oai wants to merge 11 commits into
Conversation
…/psec-4922-repeated-approval-client-integrity
…/psec-4922-repeated-approval-client-integrity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A command item can receive more than one approval callback. Clients already accept an optional callback ID, but several app-server and TUI paths still treated the command item and callback as the same identity. A follow-up callback could therefore replace parent command metadata, complete the item twice, or offer persistence choices that a one-shot callback cannot honor.
The TUI also correlated pending app-server prompts with thread-local semantic IDs instead of the exact outer JSON-RPC request. Equal IDs across watched threads could collide, while a delayed response to a remotely resolved request could consume a newer same-key request.
This is a client-integrity prerequisite in the PSEC-4922 stack. It does not make core emit fresh retry callback IDs and does not close PSEC-4922 by itself.
What
itemIdas the stable command identity and treatapprovalId, when present, as the per-callback UI/state and internal callback identity.approvalIdmay be omitted.How
The app-server stores parent command metadata independently from each approval callback, records whether a callback started a new item, and consumes the parent record on its single terminal path. Protocol, Session, and active and inactive TUI fallback logic use the callback ID to select conservative one-shot choices when the server did not provide an explicit decision list. Existing explicit decision lists remain authoritative.
The TUI validates request thread IDs before registration, namespaces semantic lookup keys by thread, and carries the outer
RequestIdin a dedicated exact-resolution event. Registry removal requires the same typed thread, semantic key or turn, and outer request ID. Replay/status state is authoritative by exact request generation, and UI dismissal uses the same identity across approvals, user input, and MCP elicitation. Any stale or mismatched response is a no-op.This boundary is larger than a mechanical change because the identity rule must agree across protocol fallback, active and replayed TUI state, app-server lifecycle handling, public documentation, and the corresponding race matrix.
Testing
just test -p codex-protocol callback_without_explicit_decisions_is_one_shotjust test -p codex-core callback_without_explicit_decisions_is_one_shotjust test -p codex-app-server-protocol(251 passed)just test -p codex-tui app_server(129 passed)just test -p codex-tui: 2,971 passed, 2 failed, 4 skipped; both failures were unchanged Guardian feature-flag tests reproduced twice on the exact pre-correlation branch baselinejust fix -p codex-tuiandjust fmtsqlxrequirement; required cross-platform CI, including native Windows and argument-comment lint, is pending before this draft is marked readyRelated: PSEC-4922