Complete Codex conversation-domain typed surface#220
Merged
Conversation
VolkerChristian
force-pushed
the
codex/phase-a1-1-conversation-domain
branch
2 times, most recently
from
July 24, 2026 03:46
32b25c1 to
71bd25d
Compare
VolkerChristian
force-pushed
the
codex/phase-a1-1-conversation-domain
branch
from
July 24, 2026 05:20
725edf0 to
8007d60
Compare
Signed-off-by: Volker Christian <me@vchrist.at>
VolkerChristian
marked this pull request as ready for review
July 24, 2026 07:54
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.
Phase A1.1: stable conversation-domain typed surface
This is the single draft PR and feature branch for the complete A1.1 architectural milestone. It will remain draft, open, and unmerged while all six dependency-aware commits are built and verified.
Start state
a226e3df5efd55b5dbef12cb1760674388909d7c(matches the prompt's expected master)cfc129ec879c70fc09c165035f6d1390f61289b8: verified ancestorcodex/phase-a1-1-conversation-domainRequired six commits
6953b9205d900c72cdb0a3389b0c8ff9037bfd79— Audit and freeze Codex A1.1 implementation batches8007d602915a402f9c29661e162142990060c744— Add Codex conversation union and value foundations8fc94aa93fffb11038984f81f11d9a23878eb230— Complete Codex ThreadItem and ResponseItem models61f0ffd16781d9c465b7c983e3055591c938377b— Complete Codex thread and turn operationsbb43f4f022fe5b1fe354c98b089d0991313be3eb— Complete Codex A1.1 notifications and preservationb087c1931ea348df330d323599087aefc1490d96— Close and verify the Codex A1.1 sliceCorrected A1.1 taxonomy
The denominator is exactly 151 registry identities:
ThreadItemdiscriminator identitiesResponseItemdiscriminator identitiesThere are also exactly 22 paired successful-result roots. They are implementation obligations, not additional registry identities; this PR never reports 173 as the A1.1 denominator. A1.1 has zero client notifications, server requests, and server responses.
Classification:
StablePublicRoot59,StableItemRoot34,SharedCommon26,RootOwnedNestedUnion16,SharedWithinSlice16. Module ownership:ThreadsTurnsSessions125,Common26.Mechanically frozen start: 26 Partial / 125 NotImplemented. Starting global metrics: 16 Complete / 34 Partial / 289 NotImplemented / 48 NotApplicable. Expected exact closure after Commit 5: A1.1 151 Complete / 0 Partial / 0 NotImplemented; global 167 Complete / 8 Partial / 164 NotImplemented / 48 NotApplicable. The exact residual partial set remains
initialize,initialized,error,model/rerouted,account/chatgptAuthTokens/refresh, and the three approval/input server requests.Operation map and result contracts
All operations remain on the grouped typed facade and reuse the one
RawProtocolengine:thread/archivetyped::Threads::archivethread/compact/starttyped::Threads::startCompactionthread/deletetyped::Threads::removethread/forktyped::Threads::forkThreadForkResponsethread/goal/cleartyped::Threads::clearGoalThreadGoalClearResponsethread/goal/gettyped::Threads::getGoalThreadGoalGetResponsethread/goal/settyped::Threads::setGoalThreadGoalSetResponsethread/inject_itemstyped::Threads::injectItemsthread/listtyped::Threads::listThreadListResponsethread/loaded/listtyped::Threads::listLoadedThreadLoadedListResponsethread/metadata/updatetyped::Threads::updateMetadataThreadMetadataUpdateResponsethread/name/settyped::Threads::setNamethread/readtyped::Threads::readThreadReadResponsethread/resumetyped::Threads::resumeThreadResumeResponsethread/rollbacktyped::Threads::rollbackThreadRollbackResponsethread/shellCommandtyped::Threads::shellCommandthread/starttyped::Threads::startThreadStartResponsethread/unarchivetyped::Threads::unarchiveThreadUnarchiveResponsethread/unsubscribetyped::Threads::unsubscribeThreadUnsubscribeResponseturn/interrupttyped::Turns::interruptturn/starttyped::Turns::startTurnStartResponseturn/steertyped::Turns::steerTurnSteerResponseResult-kind total: 7 Unit / 15 Concrete. No
sessions()facade is planned.Frozen notification/item/union surface
Notifications (37):
item/agentMessage/delta,item/commandExecution/outputDelta,item/commandExecution/terminalInteraction,item/completed,item/fileChange/outputDelta,item/fileChange/patchUpdated,item/mcpToolCall/progress,item/plan/delta,item/reasoning/summaryPartAdded,item/reasoning/summaryTextDelta,item/reasoning/textDelta,item/started,thread/archived,thread/closed,thread/compacted,thread/deleted,thread/goal/cleared,thread/goal/updated,thread/name/updated,thread/realtime/closed,thread/realtime/error,thread/realtime/itemAdded,thread/realtime/outputAudio/delta,thread/realtime/sdp,thread/realtime/started,thread/realtime/transcript/delta,thread/realtime/transcript/done,thread/settings/updated,thread/started,thread/status/changed,thread/tokenUsage/updated,thread/unarchived,turn/completed,turn/diff/updated,turn/moderationMetadata,turn/plan/updated,turn/started.ThreadItem(18):agentMessage,collabAgentToolCall,commandExecution,contextCompaction,dynamicToolCall,enteredReviewMode,exitedReviewMode,fileChange,hookPrompt,imageGeneration,imageView,mcpToolCall,plan,reasoning,sleep,subAgentActivity,userMessage,webSearch.using Item = ThreadItemremains.ResponseItem(16, distinct fromThreadItem):agent_message,compaction,compaction_trigger,context_compaction,custom_tool_call,custom_tool_call_output,function_call,function_call_output,image_generation_call,local_shell_call,message,other,reasoning,tool_search_call,tool_search_output,web_search_call.Nested families (58):
AgentMessageInputContent2,AskForApproval4,CommandAction4,ContentItem3,DynamicToolCallOutputContentItem2,FunctionCallOutputContentItem3,LocalShellAction1,PatchChangeKind3,ReasoningItemContent2,ReasoningItemReasoningSummary1,ResponsesApiWebSearchAction4,SandboxPolicy4,SessionSource7,SubAgentSource5,ThreadStatus4,UserInput5,WebSearchAction4.Full schema-definition closure
The 100 stable seed definitions reach exactly 164 named definitions and 698 nested schema paths.
PublicHandwrittenType, 26OpenStringEnum, 10ReusedExistingType, 1StrongIdentifier.CodexErrorInfo,NonSteerableTurnKind,TurnError).Every path has an exact C++ owner/member/base/wrapped type mapping. The only opaque JSON positions are the 14 paths explicitly authorized by the vendored protocol schemas.
Fixture and mutation plan
Frozen obligations: 173 positive roles, 104 current positive records, 83 planned fixtures; 810 required-field removals; 477 optional omissions; 435 omitted/null/value nullable cases for each state; 1,287 wrong-type cases (1,279 applicable, 8 explicitly opaque); 151 future discriminators; 118 applicable missing discriminators; 4 applicable discriminator conflicts; 130 applicable malformed-known cases; 55 identity-specific future-open-enum occurrences. The independent Draft-07 fixture path remains the authority.
At the Commit 5 boundary the indexed corpus contains 3,714 records: 1,415 positive and 2,299 negative. All A1.1 positive obligations are current; the 798-record notification production report contains 161 positive and 637 exact negative records.
The A1.0 Unit regression copies
ThreadArchiveResponse, adds a property, proves the contract becomes Concrete, and proves the reviewed seven-Unit identity ratchet fails. It does not impose the false inverse on Concrete schemas.Public/API and dispatch design
Public types, grouped facade names, compatibility aliases/forwarders, strong IDs, open string enums, tri-state values, and explicit direction-specific unknown alternatives are handwritten. Private repetitive codec descriptors are generated and checked in. Production dispatch always begins at the exact canonical
ProtocolSurfaceRegistryrow; generated reports/descriptors are not a second runtime authority. One transport, JSONL engine, ID allocator, pending registries, generation boundary, cancellation/order mechanism, occurrence-token mechanism, and observer sets remain.Unknown future discriminators/open-enum values are
ForwardCompatibility; malformed known payloads areMalformedKnownPayload/ProtocolWarning. Diagnostics retain identity/path without payload secrets, and typed decoding does not fail the connection.Commit 2 implementation result
Commit 2 closes the exact dependency-planned B2 batch: 26/26 SharedCommon identities are Complete —
AskForApproval4,CommandAction4,DynamicToolCallOutputContentItem2,PatchChangeKind3,SandboxPolicy4,UserInput5, andWebSearchAction4. The staged A1.1 state is now 26 Complete / 26 Partial / 99 NotImplemented; staged global metrics are 42 Complete / 34 Partial / 263 NotImplemented / 48 NotApplicable. No later-batch identity was promoted.The B2 closure contains 12 named definitions: 9
PublicHandwrittenType, 2OpenStringEnum, and 1StrongIdentifier; directionality is 7 bidirectional / 5 decode-only. It introduces the reusableOptionalNullable<T>tri-state, strong path/range/value types, direction-specific aggregates, raw-retaining explicit unknown alternatives, and openImageDetail/NetworkAccessvalues.TurnInputremains a compatibility alias for canonicalUserInput; existing turn encoding delegates to the shared codec.The generated private descriptor artifact maps exactly 26 canonical
ProtocolSurfaceKeyvalues to 26 distinct production targets (13 bidirectional, 13 decode-only; 3 scalar-string, 1 externally tagged, 22 internally tagged). Validation now rejects missing/duplicate/wrong targets, descriptor/row category-domain-field drift—including coherent row+descriptor drift—stale descriptors, shape/direction mismatches, false completeness, demotion, and retained targets after row removal with exact diagnostic-code multisets.The indexed corpus now has 482 records: 352 positive and 130 negative. B2 adds/exercises 26 base alternatives, 21 optional-omitted cases, 12 explicit-null cases, six known open-enum values, seven future discriminators, two future enum fixtures, 44 required/discriminator removals, and 65 nested/discriminator wrong-type mutations. All 15 bidirectional omitted/null supplements re-encode exactly; future open-enum values, including the schema-valid empty string, round-trip without inventing a closed-enum restriction. Aggregate mutation accounting is 1,373 required-field rejections, 1,360 wrong-type rejections plus 13 protocol-unconstrained exclusions, and 1,126 accepted optional omissions.
Commit 3 implementation result
Commit 3 closes the exact dependency-planned B3 batch: 50/50 identities are Complete — all 18
ThreadItemalternatives, all 16 distinctResponseItemalternatives, and 16 dependency-closed nested alternatives acrossAgentMessageInputContent2,ContentItem3,FunctionCallOutputContentItem3,LocalShellAction1,ReasoningItemContent2,ReasoningItemReasoningSummary1, andResponsesApiWebSearchAction4. The staged A1.1 state is now 76 Complete / 18 Partial / 57 NotImplemented; staged global metrics are 92 Complete / 26 Partial / 221 NotImplemented / 48 NotApplicable. No B4/B5 identity was promoted.The B3 closure contains 32 named definitions: 22
PublicHandwrittenTypeand 10OpenStringEnum; directionality is 31 decode-only / 1 bidirectional.ThreadItemandResponseItemhave distinct generated private target families and direction-specific unknown alternatives. Production decoding starts at the exact canonical registry row; the registry/descriptor validator now covers missing, duplicate, swapped, category/domain/field drift, descriptor-only and row-only drift, coherent drift, demotion, stale target, removed row, and false completeness with exact diagnostic-code multisets.The indexed corpus is now exactly 1,324 records: 654 positive / 670 negative, with 1,325 packaged JSON files including
index.json. B3 adds exact known/unknown/malformed coverage for every item/nested alternative, 257 applicable wrong-nested-type cases, 24 helper positives, 24 future/empty open-enum cases, and exactly seven audited protocol-opaque B3 leaf positions. Numeric tests lock int32, int64, uint32, and uint64 bounds and fractional rejection. The 39 B3 definition factories plus both item-localMessagePhasefactories have exact value andisKnown()ratchets.The ten newly known, A2-unmodeled
ThreadItemalternatives preserve their priorUnknownItemobservability. Stable-ID items remain onItemUpsertedwith exact raw/common metadata and the byte-equivalent Frontend Protocol v1 metadata-only snapshot; ID-less items retain the existing bounded, original-size-accounted, recursively redacted extension fallback. The existing eight item reducers retain their prior semantics. No frontend or application production file changed in this commit.Commit 4 implementation result
Commit 4 closes the exact dependency-planned B4 batch: 38/38 identities are Complete — all 22 stable client requests plus
SessionSource7,SubAgentSource5, andThreadStatus4. The staged A1.1 state is 114 Complete / 12 Partial / 25 NotImplemented; staged global metrics are 130 Complete / 20 Partial / 189 NotImplemented / 48 NotApplicable. The residual rows are exclusively the 37 B5 notifications; no unrelated slice changed.All 19 thread operations and three turn operations use the grouped facade and the one existing
RawProtocol. The exact contracts are 7 Unit / 15 Concrete. OneUnittype is shared;TurnInterruptResultremains its compatibility alias. The six pre-existing operation families retain exact source-compatible overloads; canonicalstart,list, andreaduse constrained forwarding templates to avoid brace-init ambiguity. Deprecatedthread/rollbackremains explicitly exposed. There is no sessions facade, second engine, pending map, worker, frontend operation, or BackendCommand.The B4 closure is exactly 72 definitions: 50
PublicHandwrittenType, 11OpenStringEnum, 10ReusedExistingType, and 1StrongIdentifier; directionality is 5 bidirectional / 38 decode-only / 29 encode-only. Its 227 schema paths comprise 210 properties, 14 array elements, and three map values with 99 required, three optional, 104 optional-nullable, and four defaulted positions.Production evidence contains exactly 22 operation descriptors; 1,166 result records (403 valid / 763 negative); 73 aggregate/value records; 60 B4 union records; and four active-flag records. All 1,303 referenced fixtures and all 25 production-source records match their recorded paths, byte counts, and SHA-256 values.
Commit 4 validation boundary:
EPERMon temporary AF_UNIX bind and passed unsandboxed: 2/2.src/ai/openai/codex/frontend/,src/apps/codex-backend/, andsrc/apps/codex-backend-client/: empty.AppServerClientremains two pointers,typed::Clientone pointer;git diff --check: pass.Test-integrity accounting for Commit 4: 20 test files changed (+5,422/-117), including 18 component/installed files (+5,371/-114);
tests/policy/is unchanged and the installed consumer adds five lines. Four focused tests are new. No A0/A1.0 regression was deleted, renamed, merged, or weakened; existing protocol, reducer, codec, fixture, surface, registry, and facade assertions remain and gain exact contract, raw-retention, field-path, descriptor, compatibility-signature, and diagnostic-code coverage.Commit 5 implementation result
Commit 5 closes the exact dependency-planned B5 batch: 37/37 server-notification identities are Complete. The final A1.1 exact ratchet is 151 Complete / 0 Partial / 0 NotImplemented / 0 NotApplicable; global metrics are 167 Complete / 8 Partial / 164 NotImplemented / 48 NotApplicable. No unrelated slice was promoted.
The B5 closure is exactly 48 named definitions and all 37 stable inbound notifications have complete public payload types, raw envelope retention, exact registry-first dispatch, and generated private codec descriptors. The descriptor table has 39 server-notification targets: the exact 37 A1.1 rows plus the two residual typed A1.0 rows
errorandmodel/rerouted. Stable realtime inbound methods are typed; experimental outbound realtime methods remain absent.The notification production report contains exactly 798 records: 161 positive and 637 negative (37 base, 65 optional omission, 57 nullable state, 2 required-nullable, 279 missing-required, and 358 wrong-type records). The full indexed corpus is 3,714 records: 1,415 positive / 2,299 negative, with 3,715 packaged JSON files including
index.json.All existing 12 modeled reducer arms remain unchanged. The 25 newly typed, A2-unmodeled notification methods route explicitly through
preserveUnmodeledTypedEvent(...)to boundedCodexExtensionReceivedstate with registry identity, bounded raw payload, diagnostic, legacy optional decode error, original-size accounting, and existing snapshot-boundary redaction. High-volume realtime audio/transcript deltas use this same bounded path and do not accumulate unbounded state.Commit 5 validation boundary:
EPERMwas rerun with host permissions.git diff --check: pass.src/ai/openai/codex/frontend/,src/apps/codex-backend/, andsrc/apps/codex-backend-client/: empty. No outbound realtime or guardian operation was exposed.Test-integrity accounting for Commit 5: 9 test files changed (+2,015/-41), including two new focused notification tests;
tests/policy/andtests/installed/codex/are unchanged. No A0/A1.0 regression was deleted, renamed, merged, or weakened. Existing event-decoder partial fixtures remain as explicit malformed-known exact-code cases, while schema-complete fixtures add typed-field/raw-retention assertions; registry, fixture, audit, coverage, and CMake tests retain prior assertions and add exact B5 target, field-path, mutation, preservation, bounds, and diagnostic-code ratchets.Commit 6 closure result
Commit 6 contains no scheduled runtime implementation. It adds the generated exact 151-key closure report, exact documentation-list guards, cumulative test-integrity accounting, installed API/layout coverage, source-package offline regeneration, and a literal CPack binary-package audit. The only production-tree change is listing the already-generated private
ServerNotificationCodecDescriptors.incin the target source inventory; it remains private and uninstalled.The installed audit pins exactly 27 public Codex headers, compiles representative new thread operations, turn steer, Unit, complete Thread/Turn, ThreadItem, ResponseItem, shared unions, all canonical notification alternatives, distinct unknown alternatives, and intentional deprecated compatibility APIs. It proves
AppServerClientremains two pointers andtyped::Clientone pointer, and that all three Codex libraries retain SOVERSION 1.The source package retains 3,715 fixture files (3,714 indexed records), 13 evidence files, and seven offline tools, then re-runs schema/source integrity, contracts, descriptors, operation/notification coverage, audit/type closure, fixture generation/check/validation, and the final closure report from the extracted archive. The binary audit produces exactly three Codex component TGZ archives and verifies the exact 27-header and three
.so.1inventories while rejecting schemas, evidence, fixtures, generators, tests, docs, private descriptors, JSON, Python, and C++ source.Commit 6 validation boundary:
git diff --check: pass.Backend/frontend boundary
Implementation preserves all existing modeled reducers. New typed but A2-unmodeled notifications use the bounded extension-preservation path; newly typed items preserve the existing ItemUpserted/metadata-only snapshot path with the bounded extension fallback for ID-less items. There is no new BackendCommand, canonical-state meaning, frontend command/event/snapshot field, remote operation, or security decision. Frontend Protocol v1/schema and
codex-backend-clientbehavior remain unchanged. No SOVERSION changed;AppServerClientandtyped::Clientretain their PIMPL layouts.Commit 1 validation boundary
ctest -N: 253 tests;CodexA11AuditToolTestpresent as test 173.EPERMand passed unsandboxed;CodexTypedAppServerIntegrationTestskipped through its established credential/quota gate.1614414e…c705, pland95e81e8…1045, closure89ce92cf…8d22.DirectionalityMismatch,DiscriminatorLiteralMismatch,CrossSliceOwnershipMismatch,OptionalNullableMappingMismatch,StrongIdentifierMappingMismatch,CppPathMappingMismatch, andCppDefinitionMappingMismatch.git diff --check: pass.Test-integrity accounting for Commit 1: no A0/A1.0 test was deleted, renamed, merged, or weakened. The operation-contract test adds the exact Unit mutation. Source-package and staged-installed-consumer tests retain their old assertions and add exact private/source evidence guards. The audit test is new and asserts exact diagnostic multisets. CMake only registers the new test.
Commit 2 validation boundary
ctest -N: 254 registered tests;CodexConversationCodecTestis present.CodexTypedAppServerIntegrationTestskipped; raw non-credential App Server handshake passed.codex-backendandcodex-backend-clientbuild: pass.BackendAdapter.cpp(+31/-10); there is no app production diff and no frontend representation change.git diff --check: pass.Test-integrity accounting for Commit 2: 12 test files changed, +1,610/-35; no policy test changed. No A0/A1.0 test was deleted, renamed, merged, or weakened. Existing fixture/surface guards retain their prior assertions and add deterministic B2 corpus/descriptor mutations; registry tests retain all prior exact-code checks and add bidirectional canonical-key guards; TurnCodec retains wire assertions while using canonical value types; installed consumers retain prior API checks and add representative tri-state/open-enum/unknown/compatibility coverage. The 35 removed lines are count updates, replacement of partial compatibility construction, or superseded weak count expectations; behavioral and exact diagnostic assertions are stronger.
Commit 3 validation boundary
CodexTypedAppServerIntegrationTestskipped; raw non-credential handshake and all AF_UNIX acceptance paths passed.git diff --check: pass.codex-backendandcodex-backend-clientbuild: pass.src/ai/openai/codex/frontend/,src/apps/codex-backend/, andsrc/apps/codex-backend-client/: empty.tests/component/codex/(+3,694/-156);tests/policy/andtests/installed/codex/are unchanged. Three focused tests are new. No A0/A1.0 regression was deleted, renamed, merged, or weakened; migrated tests retain behavior/raw/nullable/boundary assertions and strengthen unknown-vs-malformed checks to exact kind/severity/surface/path.Final validation on rewritten head
Final head:
b087c1931ea348df330d323599087aefc1490d96.ctest -N: exactly 267 registered tests. Full suite: 266 passed / 0 failed / 1 skipped in 304.56s. Codex label: 95 passed / 0 failed / the same 1 skipped in 280.17s.SNODEC_RUN_CODEX_TYPED_INTEGRATION=1was unset because the test may consume credentials/quota. The raw non-credential App Server integration passed.bind()EPERM; the exact host-permission rerun passed all four.codex-backendandcodex-backend-clienttargets: pass.git diff --check: pass.-Wswitch-enum/-Wnrvoportability defects in the new B2-B4 codecs; they were fixed in their owning commits and all guarded coverage evidence was regenerated. A full Clang apps build remains unavailable because byte-identical, pre-A1.1frontend/Codec.cppandsnodec-control/ConfigActions.cpptrigger Clang 21-Wnrvounder project-Werror; those out-of-scope files were not altered.--no-undefined..so.1libraries, with zero private/source-only artifacts.b087c1931ea348df330d323599087aefc1490d96; its singlegcc-debugjob and every checkout/dependency/configure/build/test/finalization step passed (2026-07-24 05:22:26–05:46:25 UTC). Hosted CTest reported 267 registered, 0 failed, and 2 skipped: the raw integration because the runner has nocodexexecutable onPATH, and the typed integration behind its credential/quota gate. The same raw non-credential integration passed locally where the pinned executable was available.Current limitations / explicitly out of scope
All six logical commits, all mandated local validation, and final GitHub Actions run 30069256036 are complete and successful. A1.2–A1.4, A2, A3, Context UI, MQTT, REST, WebSocket, Qt, and other application integration are not implemented here. Experimental outbound realtime methods remain absent. No destructive/shell operation will be run against a real user environment.
Codex has not merged this PR.