Skip to content

Codex probe hardening: clean up, time out, stay isolated (PR #92 follow-up, #88) #93

Closed

Description

@erickb336

Follow-up of PR #92 (issue #88, unit 1). Size: small. Sage task T209. Found in the sage's review; not blocking, because the probe runs only by hand.

Goal

The native Codex lifecycle probe (scripts/probe-codex-lifecycle.mjs and scripts/fixtures/codex-native/) always cleans up, never hangs, and stays isolated.

Findings to fix

  1. Medium, no clean-up. The probe never deletes its temporary folder in any exit path: success, a version failure, a listener failure, a setup assert or a fixture failure. Each run leaves a Codex profile in TMPDIR with a trusted hooks.json and config.toml, the capture script, session transcripts and the events folder. Delete it in a finally block with rmSync and the recursive and force options.
  2. Medium, no timeout. The probe waits without limit on codex --version, on codex app-server in the setup, and on codex exec. A stalled Codex hangs the probe forever, and then nothing cleans up. Add a wide timeout with a reason in the code (standing order 26). On timeout, end stdin, report the failure, and clean up.
  3. Low, the hook command path. setup-capture.mjs writes the hook command as node followed by the JSON-quoted script path, and Codex runs a command hook through a shell. JSON quoting does not stop command substitution or backticks inside double quotes. Refuse a root path that holds any character other than letters, digits, slash, dot, underscore and dash.
  4. Low, telemetry. The probe's environment sets no telemetry switch. Set DO_NOT_TRACK=1 and Codex's own analytics or OTEL off switch (standing order 10). The app-server setup run has no loopback provider override: confirm that it makes no model or network request, or add the override.
  5. Low, scope wording. claude-parity-audit.md and automatic-workflow-design.md say that unit 1 covers owner prompt identity, denial behaviour, ordering and compaction. The probe covers only the spawn, result, start and stop lifecycle. Make the unit-1 text say what this probe covers, and list the rest as later units on Missing feature: automatic Sage workflows and gated autopilot in Codex #88.

Acceptance

  • A test, or the probe itself, shows that a failed run and a timed-out run leave no temporary folder.
  • npm run build, npm run check and npm test pass. Every run puts fake ps, pgrep and kill first on PATH.

Activity

  1. added
    codex
    on Oct 11, 2026
  2. erickb336 commented on Oct 11, 2026

    @erickb336
    OwnerAuthor

    Also from PR #92's QA (run R719): the two documents (packages/sage-codex/runtime/automatic-workflow-design.md and claude-parity-audit.md, and their built copies) use two words that the sage dictionary flags: "stage" (for example "first delivery stage") and "gates" (in "merge gates"). AGENTS.md asks for the approved words in writing/dictionary.md, and npm run check does not scan these files today. Use the approved words, and add these files to the dictionary check.

    QA also found 9 old probe folders, of up to 3.9 MB each, in the user temp folder from earlier runs. The clean-up fix should say how to remove them.

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

    codex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions