Codex - #229
Merged
Merged
Conversation
Extend hook normalization with idempotent `cx_` session IDs and `openai/` model IDs for Codex, with focused regression tests. Record T01's implementation and verification in the Codex CLI integration plan. Plan: codex-cli-integration (T01) Co-authored-by: SCE <sce@crocoder.dev>
Extend the canonical Pkl generation pipeline with a skills-only Codex target that reuses the shared workflow and decision-skill composition without adding command or prompt outputs. Update artifact inventories, metadata coverage, cross-target contracts, and durable context to cover the fourth target and its 133-file generated payload. Plan: codex-cli-integration.md (T02) Co-authored-by: SCE <sce@crocoder.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add canonical Pkl renders for `.codex/hooks.json` and the fail-open install-guidance hook so all registered Codex lifecycle events dispatch through `sce hooks codex`. Extend the generation mappings and exact artifact contract to include the two outputs, and document the resulting Codex surface and completed integration task. Plan: codex-cli-integration (T03) Co-authored-by: SCE <sce@crocoder.dev>
Expose Codex's dual `.agents/` and `.codex/` generated roots as a fourth setup target, including `--codex`, `--all` expansion, interactive selection, target persistence, and schema validation. Stage the two generated roots into a build-time manifest and install their prefixed asset paths at the repository root while preserving existing target behavior; add coverage for embedding, resolution, and installation. Ref: context/plans/codex-cli-integration.md (T04, T05) Co-authored-by: SCE <sce@crocoder.dev>
Add typed Codex hook-event parsing and route supported lifecycle/tool combinations to distinct stub arms while treating unsupported inputs as deterministic no-ops. Wire `sce hooks codex` through CLI parsing and runtime dispatch, log malformed payloads, and fail open so hook execution remains successful until later capture and policy tasks. Document the new hook surface and completed integration task. Plan: codex-cli-integration (T06) Co-authored-by: SCE <sce@crocoder.dev>
Implement UserPromptSubmit dispatch persistence with existing messages/parts helpers, storing idempotently prefixed cx_ sessions and deterministic cx:<turn_id>:user message IDs. Add injectable coverage for validation, prefixing, and parent-message deduplication. Document the completed runtime contract and update the Codex integration plan and related CLI/context references. Plan: codex-cli-integration (T07) Co-authored-by: SCE <sce@crocoder.dev>
Persist Codex Stop events as assistant messages and text parts through the existing Agent Trace database helpers, using deterministic IDs and idempotent session prefixing. Update the Codex dispatch contract and repository context to describe the completed capture behavior while retaining stubs for the remaining arms. Plan: codex-cli-integration (T08) Co-authored-by: SCE <sce@crocoder.dev>
Apply the existing Bash policy evaluator to Codex PreToolUse(Bash) events so policy behavior remains consistent without duplicating matching logic. Return silent output for allowed commands and Codex-native deny JSON containing the policy ID and blocking message for denied commands, without creating trace records. Update the Codex runtime and repository context to document the newly implemented dispatch arm and completed task. Plan: codex-cli-integration (T09) Co-authored-by: SCE <sce@crocoder.dev>
Extend doctor target detection and inventory inspection to cover Codex skills and hook assets, including trust and review guidance for unhealthy hooks. Add typed Codex problem mappings, deterministic rendering, and regression coverage while updating the operator-health contracts. Plan: codex-cli-integration (T13) Co-authored-by: SCE <sce@crocoder.dev>
Parse Codex apply_patch payloads, normalize provable Add/Update evidence into SCE patch text, and persist one diff-trace row with Codex session and model attribution. Register the PostToolUse hook while keeping Delete-only and malformed inputs fail-open without evidence, and preserve synthetic-line attribution through the existing post-commit intersection path. Plan: codex-cli-integration; Tasks: T10, T11, T12 Co-authored-by: SCE <sce@crocoder.dev>
Codex hook handling needed to accept current upstream apply_patch input while preserving silent fail-open behavior and conservative attribution boundaries. - Resolve patch paths from the event cwd against the real Git root and normalize supported outer wrappers before parsing. - Validate sessions, preserve truthful model IDs, and allocate event-scoped synthetic evidence identities without changing generic intersection behavior. - Make generated hook invocation root-aware and add end-to-end, parser, path, contract, and regression coverage. - Record the durable contracts and the remaining repeated-content attribution ambiguity. Plan: codex-cli-integration (T14-T19) Co-authored-by: SCE <sce@crocoder.dev>
Allow valid parent traversal and absolute paths when canonical resolution remains inside the Git worktree, while preserving symlink-escape protection for existing and missing targets. Add coverage and durable context for nested cwd, Add File, move, malformed, and outside-path behavior. Plan: `codex-cli-integration` (T20) Co-authored-by: SCE <sce@crocoder.dev>
Codex hook persistence must distinguish a legitimate null assistant message from malformed identifiers and avoid writing fabricated epoch timestamps. Trim session and turn IDs before persistence, short-circuit null Stop events before opening the trace database, preserve explicit empty messages, and fail open when timestamp acquisition fails. Plan: codex-cli-integration (T24) Co-authored-by: SCE <sce@crocoder.dev>
…ffects T24 correctly distinguished missing/null/empty/present last_assistant_message and propagated timestamp failures through the outer fail-open boundary, but Stop still branched on last_assistant_message presence before validating session_id/turn_id, so a null Stop with a missing or blank session_id/turn_id incorrectly short-circuited to a successful no-op instead of being rejected as malformed. Both handlers now extract a single validated representation (ValidatedStop/ValidatedUserPromptSubmit) before any side effect: session_id and turn_id are validated/trimmed first, then (for Stop) last_assistant_message presence is classified, and only then does timestamp acquisition or DB access occur. An explicit null Stop is a successful no-op only once its identifiers are confirmed valid. Re-verified upstream openai/codex at commit 343074d4207d572809bd8cea15f4be1d09d98e0b (byte-identical to current main c9b19deb09c1841ce7acc33ddb96276030936a29): Stop's session_id/turn_id are required non-nullable strings (nullability applies only to last_assistant_message), and UserPromptSubmit's session_id/turn_id/prompt are likewise all required non-nullable strings. Co-authored-by: SCE <sce@crocoder.dev>
Prevent replayed or concurrent Codex UserPromptSubmit and Stop deliveries from duplicating message/part rows by using one transactional existence check and pair insert with rollback on failure. Update the related runtime documentation and complete plan task T25 with verification evidence. Plan: codex-cli-integration (T25) Co-authored-by: SCE <sce@crocoder.dev>
Correct the transaction documentation to distinguish duplicate no-write commits returning `Ok(false)` from genuine failures that roll back. Update the Agent Trace DB context and Codex integration plan with the corrected contract and T26 validation evidence. Plan: codex-cli-integration (T26) Co-authored-by: SCE <sce@crocoder.dev>
Allow the parser to preserve absolute and `..` paths so cwd-aware resolution can validate containment against the canonical Git worktree. Add dispatcher-level coverage for safe and escaping paths, and record corrected T20/AC26 verification evidence. Plan: codex-cli-integration (T20, AC26) Co-authored-by: SCE <sce@crocoder.dev>
Prevent structurally current Codex project registrations from appearing healthy when the effective managed-only policy excludes project hooks. Probe Codex's composed policy once per doctor invocation, classify blocked and unknown policy separately from trust, reuse the result across registrations and reports, and keep repairs limited to structural drift. Plan: codex-cli-integration.md — T22 (follow-up correctness fix #3) Co-authored-by: SCE <sce@crocoder.dev>
Define typed Codex metadata for catalog workflows and render explicit-only agents/openai.yaml policy blocks, while documenting the standalone renderer and capturing the remaining integration work in the staged plan. Plan: codex-explicit-workflow-invocation (T01) Co-authored-by: SCE <sce@crocoder.dev>
Wire the typed Codex `agents/openai.yaml` renderer into the emitted skill-document inventory for all six catalog workflows, disabling implicit invocation and excluding `sce-decision`. Extend exact inventory and generation-contract checks to validate catalog-derived metadata and update the artifact count to 141, with corresponding documentation and plan updates. Plan: codex-explicit-workflow-invocation (T02) Co-authored-by: SCE <sce@crocoder.dev>
Because Codex workflow skills disable implicit invocation, each generated Input section needs a concrete command users can run. Thread a target-specific invocation example through shared workflow composition, author examples for all six catalog workflows, and enforce their presence with the generation contract while leaving OpenCode, Claude, and Pi output unchanged. Complete the corresponding plan task and record the validation evidence. Ref: context/plans/codex-explicit-workflow-invocation.md#T03 Co-authored-by: SCE <sce@crocoder.dev>
The test now derives parent traversal from the current working-directory depth and adds extra levels, ensuring traversal reaches the filesystem root across platforms with different temporary-directory nesting. Co-authored-by: SCE <sce@crocoder.dev>
Define repository-local SCE skills for planning, decisions, handovers, task execution, validation, and commit workflows, with shared references and agent metadata. Add Codex hook installation guidance and enable Codex as an integration target. This makes the canonical workflows available to agent tooling while preserving the existing automatic trace synchronization configuration. Co-authored-by: SCE <sce@crocoder.dev>
davidabram
added a commit
that referenced
this pull request
Aug 24, 2026
Reuse the shared Codex hook configuration service to classify each required registration independently, preserving unrelated user handlers and repairing only structural drift through the existing merge path. Add a read-only mirror of Codex's persisted hook-trust bookkeeping so doctor reports untrusted, modified, disabled, and unknown registrations without attempting to grant consent. Wire the new states through doctor health/problem rendering and document the per-registration contract, including the TOML dependency required to read Codex's config. Fix three correctness issues found in review (PR #229): - Structural diagnosis scanned only the first matcher group matching a registration's event, so an SCE-owned handler duplicated or misplaced in a second matcher group could be invisible to diagnosis while setup's merge (which scrubs owned handlers across every group for the event) would still rewrite the document, breaking the PresentAndCurrent-implies-no-op-merge invariant. Diagnosis now scans every matcher group for the event and requires exactly one owned handler, in the canonical group, matching the canonical handler, to report PresentAndCurrent. - Trust-state reading independently parsed `enabled`/`trusted_hash`, so a malformed `enabled` field next to a correct `trusted_hash` could still read Trusted. Upstream deserializes the whole state entry and discards it entirely on any error; the state entry type now derives Deserialize directly and is read the same way, so a malformed field drops the whole entry rather than being salvaged field-by-field. - The merge itself still always relocated the canonical handler into the first matcher-matching group, so a document already diagnosed PresentAndCurrent with its canonical handler in a non-first matching group would still be rewritten by merge_or_create, a second violation of the same no-op invariant. merge_event_groups now scans every group the same way diagnosis does and returns the document completely untouched whenever it is already canonical wherever that handler lives, repairing only when it genuinely isn't. Plan: `context/plans/codex-cli-integration.md` (T22) Co-authored-by: SCE <sce@crocoder.dev>
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.
No description provided.