Skip to content

test: isolate test env, stop leaking brokers, align fake Codex with 0.157 - #1

Merged
tyk-swe merged 13 commits into
mainfrom
claude/openai-plugin-maintenance-mrbzd9
Sep 27, 2026
Merged

tyk-swe merged 13 commits into
mainfrom
claude/openai-plugin-maintenance-mrbzd9

Conversation

@tyk-swe

@tyk-swe tyk-swe commented Sep 26, 2026

Copy link
Copy Markdown
Owner
  • Strip CODEX_COMPANION_*, CLAUDE_PLUGIN_DATA, CLAUDE_ENV_FILE and API keys
    from the test process and child environments so a run inside a Claude
    session can never reach the user's real broker, plugin state or account.
  • Shut down every lazily started broker after runtime tests; one run used
    to leave ~29 broker + fake app-server process pairs behind.
  • ensureBrokerSession now kills a freshly spawned broker that never became
    ready instead of leaking it.
  • Fake Codex matches the real app-server: threads report source "vscode",
    thread/list filters by sourceKinds/modelProviders, thread/resume emits the
    full-history deprecationNotice without excludeTurns (legacy-resume rejects
    the field like 0.142.5), and thread/unsubscribe is supported.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf

….157

- Strip CODEX_COMPANION_*, CLAUDE_PLUGIN_DATA, CLAUDE_ENV_FILE and API keys
  from the test process and child environments so a run inside a Claude
  session can never reach the user's real broker, plugin state or account.
- Shut down every lazily started broker after runtime tests; one run used
  to leave ~29 broker + fake app-server process pairs behind.
- ensureBrokerSession now kills a freshly spawned broker that never became
  ready instead of leaking it.
- Fake Codex matches the real app-server: threads report source "vscode",
  thread/list filters by sourceKinds/modelProviders, thread/resume emits the
  full-history deprecationNotice without excludeTurns (legacy-resume rejects
  the field like 0.142.5), and thread/unsubscribe is supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
…t Codex

- --resume-last fallback: `codex app-server` records its threads with the
  "vscode" source, so thread/list with sourceKinds ["appServer"] never found
  anything. Query ["vscode", "appServer"] across all model providers.
- thread/resume sends excludeTurns (full-history hydration is deprecated and
  the plugin never reads turns) and retries without it on older CLIs that
  still gate the field behind experimentalApi.
- Unsubscribe from task and review threads after each run. While a thread
  stays loaded behind the shared broker, thread/resume silently ignores its
  sandbox and model overrides, so `--resume --write` after a read-only run
  stayed read-only; ephemeral review threads also piled up in the broker.
- Drop the unused, deprecated detached review delivery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
…dates

- `error` notifications with willRetry=true ("Reconnecting... 2/5") are
  logged as progress instead of recording a failure and flipping the job
  phase to failed; subagent-thread errors are logged but no longer fail the
  task; a failed turn's own `turn.error` is used when no error was seen.
- Fail fast instead of hanging forever when the app-server dies mid-turn:
  captureTurn races the turn against the connection closing, the broker
  exits (dropping its clients) when its app-server dies, requests made after
  the connection closed reject immediately, and stdin EPIPE is ignored.
- Async agent messages (delivery "async", from GPT-6 async tools) can carry
  phase "final_answer" mid-turn; they are logged as updates and can no
  longer trigger the inferred completion or become the returned answer.
- Log Codex deprecationNotice and warning notifications to the job log.
- Strip ANSI escapes and both variants of Codex's PATH warning from stderr,
  and only show stderr in native review output when the review failed.
- Opt out of streaming notifications the plugin never reads (command and
  file-change output deltas, plan deltas, turn diffs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
/codex:transfer scraped ~/.codex/external_agent_session_imports.json, a
private Codex file, and on failure could only say "did not record an
imported thread". The app-server already reports the outcome: the import
response carries an importId, and externalAgentConfig/import/completed
lists per-item successes (target = the new thread id) and failures (stage
and message).

Match the completion by importId (buffering one that arrives before the
response), take the imported thread from the SESSIONS success for this
source, surface Codex's failure message, and keep the ledger lookup only as
a fallback for older CLIs that complete without results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
All GPT-6 models use Codex's multi-agent v2 runtime, where subagent threads
are announced only by `subAgentActivity` items (no thread/started, no
collabAgentToolCall receivers), their events can arrive before that item,
and the root turn/completed does not wait for them (`ultra` effort fans out
to parallel subagents).

- Register subagent threads from subAgentActivity, park notifications for
  not-yet-known threads and replay them once the thread is registered, and
  accept follow-up turns on the same subagent thread.
- When Codex finishes while subagents are still running, interrupt them so
  nothing keeps editing the workspace after the run reports completion.
- Persist active subagent turns on the job so /codex:cancel interrupts them
  (children first, then the root, over one connection with timeouts);
  interrupting the root alone does not stop v2 subagents.
- Native reviews run in a delegate turn whose id is the only one
  turn/interrupt accepts; record it so /codex:cancel can stop a review.
- /codex:cancel marks the job cancelled before interrupting and a run that
  ends afterwards keeps that status instead of relabelling it failed.
- terminateProcessTree signals a non-group-leader pid only after `ps`
  confirms it still runs codex-companion.mjs, so recycled pids are safe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
OpenAI retired gpt-5.3-codex-spark in September 2026 and deprecated
gpt-5.4/gpt-5.4-mini; Codex now defaults to gpt-6-astra, with gpt-6-sol and
gpt-6-luna alongside it.

BREAKING CHANGE: `--model spark` is no longer rewritten to
gpt-5.3-codex-spark. Model ids are passed to Codex verbatim.

- Docs, the rescue command, agent and runtime skill describe the GPT-6
  models and the full effort range (none … xhigh, max, ultra), including
  that `ultra` fans out to parallel subagents and belongs in the background.
- /codex:setup suggests updating when the installed Codex CLI is older than
  the tested baseline (0.157.0).
- A test keeps the documented effort lists in sync with the values the
  companion accepts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
The rescue subagent's internal `gpt-5-4-prompting` skill was written for
GPT-5.4. OpenAI's GPT-6 guidance is to slim prompts and skills down and drop
GPT-5-era hand-holding: current models plan, read what they need and check
their own work, and instructions to "run the tests"/"verify everything"
cause redundant test runs.

- Rename to the model-agnostic `codex-prompting` with a short, trigger-
  specific description, and make SKILL.md a compact router.
- Mark verification_loop, completeness_contract and dig_deeper_nudge as
  opt-in blocks; trim them from the default recipes.
- Keep default_follow_through_policy: plugin runs are non-interactive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
- README: note that this is a community-maintained fork of
  openai/codex-plugin-cc, install from `tyk-swe/codex-cc`, and explain how
  to switch from the upstream marketplace (same `openai-codex` name). The
  slash commands and `codex@openai-codex` install id are unchanged. Drop
  the embedded demo video, which pointed at a file that does not exist.
- Marketplace owner is now the fork maintainer; the plugin keeps OpenAI as
  its author and gains homepage, repository and license metadata.
- NOTICE files record the modifications (Apache-2.0 section 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
A Codex thread keeps its writer lock while it is loaded, and app-server
only unloads an idle thread 60 seconds after its last subscriber leaves.
Behind the shared broker that meant `codex resume <thread>` (which the
plugin tells users to run) or another session failed right after a task
with "thread ... already has an active writer".

Start the plugin's app-servers with `thread_unload_delay_secs=0`, so the
unsubscribe at the end of a run unloads the thread immediately, and also
release the subagent threads a run subscribed to so they do not pile up in
the broker. Older CLIs accept the override (verified on 0.142.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
The fake Codex used by `npm test` had drifted from the real app-server and
hid several of the bugs fixed in this release. `npm run test:live` now
drives the companion CLI against the real `codex app-server` on PATH, with
a tiny local stand-in for the Responses API configured as a custom model
provider, so it needs no network access, account or credits (~6 s).

It checks setup, task, resume (including the --write sandbox and the
thread/list fallback), both review kinds, session transfer, cancelling a
background task and a native review, and that job logs carry no
deprecation notices or raw stderr noise. It passes on Codex 0.157.1 and
0.142.5 and fails on the previous plugin code.

CI pins Codex to the tested version and runs the live test on every pull
request; a weekly workflow runs everything against the latest Codex CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
First release of the maintained fork, for Codex CLI 0.157 and GPT-6.
The changelog lists the fixes and GPT-6 support, and calls out the one
breaking change: the `spark` model alias is gone because its target model
was retired, and `--model` now passes model IDs through unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
The execution-mode rules said to default to foreground while a later rule
said to run `--effort ultra` in the background; state the exception where
the default is defined. Also correct the CI comment about the Codex pin,
which tracks at-or-above TESTED_CODEX_VERSION rather than equalling it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 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-26T08:52:22.114257Z a522a16 PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a522a1612f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/lib/process.mjs Resolved
/codex:cancel killed a job right after interrupting its turn, before the
run could release its Codex threads. Behind the shared broker those stayed
loaded, so the next `--resume-last --write` (or `--model`) silently kept
the old settings and `codex resume <thread>` failed with "already has an
active writer". Cancel now gives the interrupted run up to 10 seconds to
finish on its own, which it normally does within a second or two after
cleaning up. Only a run that does not stop, or one that had already died,
is killed and has its threads released through the broker.

Cancel also marked the job cancelled while the run was still alive, and
the run's own read-modify-write progress updates could put back "running",
leaving the job stuck. Cancel now records the cancellation again once the
run is gone, the run treats either state file saying "cancelled" as final,
and state files are written to a temp file and renamed into place, so
concurrent writers can no longer leave a torn job file.

A process that exited but was never reaped (orphans in containers whose
init does not reap) counts as exited, so cancel does not sit out the grace
period there.

The new unit, runtime and live tests fail on the previous code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ov2nrhZWoYEZ9QRBYS7yf
@tyk-swe
tyk-swe merged commit 2b6601b into main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants