GeezerVison is showing github.com — feat(providers): clear the Codex backlog (70 scenarios) by olafura · Pull Request #615 · hal-c2/hal-c2
Conversation
olafura
commented
Oct 27, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
The last Codex behaviours the origin had were spec-only: 70 scenarios in features/providers/codex.feature were still @backlog (one of them @backlog-mobile, two @Blocked on accounts sharing a home).
This implements them on the MC and the phone, and takes every backlog tag off the file:
- Provider health: a real status probe with upstream's wordings (unchecked, disabled, cannot-start with and without a configured binary path, probe-failed, timed-out), HAL_C2_CODEX_LAUNCH_ARGS overriding instance launch arguments, a per-folder skills read bounded at 20 seconds, continuation groups so a thread can switch between accounts sharing a home (and only those), Codex 0.128.0 reported broken, and HAL-C2 introducing itself as hal_c2_desktop.
- Turns: recoverable resume (a forgotten conversation starts fresh, other resume errors surface), orchestration instructions only in default mode, file-change approval prompts (first 20 files in path order, moves, grant root), the older execCommandApproval/applyPatchApproval decisions, detailed reasoning shown, service tier kept when fast mode is on, duplicate and empty final answers dropped, memory-consolidation threads hidden, persistent tool calls outliving completed turns, question blanks filled, elicitations that cannot be presented declined, and resume asking for no earlier turns.
- Stopping: a turn finishing while it is stopped ends interrupted, a stop behind a not-yet-started turn is delivered when it starts or fails after 10 seconds with upstream's message, a turn Codex never ends is settled interrupted after 10 seconds with later output ignored, and subagents stop with their turn (including one that starts under a stopped turn). Subagent states now cover pending and running, the result is the final answer rather than commentary, and a later message reopens a finished subagent without a late report reopening a settled one.
- Usage limits: a turn that stopped before Codex named a reset learns it from the usage report that follows; a named reset does not move.
- Wire protocol: unknown requests answered -32601, a 33rd open request refused at -32001 with the waiting ones unaffected, unknown notification shapes skipped, framing (split messages, several per read, CRLF, blank lines) and error-output flooding, an open request failing with the app-server's exit code, non-protocol output closing the session, and a .cmd Codex started through cmd.exe on Windows.
- Shadow homes: a linked login refuses preparation, no file is overwritten on refusal, a home that cannot be prepared fails the turn with "Failed to materialize the Codex shadow home.", and wrong links are repaired.
- Web and tool presentation: web search entries show queries/page/text, and browser and computer tool calls get their surface, source, favicon or application icon (HalC2.Codex.ToolPresentation).
- Phone: steps for implementing a finished plan, and the scenario in the mobile runner's default list.
Tool presentation, the approval prompts and legacy decisions, and the shadow-home rules are ports of upstream's CodexToolPresentation.ts, CodexAdapterV2.ts and CodexHomeLayout.ts (pingdotgg/t3code#2829, thanks Julius Marminge); the broken-range report follows pingdotgg/t3code#13328.
Verification: mix features providers/codex.feature 159 passed; related feature files (provider-instances, provider-setup, models, usage-limits, approvals-and-questions, runs-and-queue) 124 passed; related unit tests 37 passed; native-subagents and orchestration property tests pass; the plan scenario passes in both the mobile and desktop tst_Features. The full mobile features suite currently segfaults in a tablet scenario (infinite recursion in the harness's searchObjects) — reproduced on untouched code, so pre-existing and unrelated.
Done by Muse Spark in Muse Code.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The last Codex behaviours the origin had were spec-only: health-check states with upstream's wordings, a status probe and a per-folder skills read, recoverable thread/resume, file-change and legacy approval prompts, browser and computer tool presentation, interrupt and subagent races, persistent tool calls, wire-protocol edges, usage-limit resets learned after a turn stopped, shadow-home refusals, account switching by continuation group, a Windows command-script shim, and the plan scenario on the phone.
Tool presentation, the approval prompts and legacy decisions, and the shadow-home rules are ports of upstream's CodexToolPresentation.ts, CodexAdapterV2.ts and CodexHomeLayout.ts (pingdotgg/t3code#2829); the broken-range report follows pingdotgg/t3code#13328.
Done by Muse Spark in Muse Code.
Co-authored-by: Julius Marminge <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ports the remaining Codex behaviours: a real status probe, recoverable resume, file-change and legacy approvals, final-answer dedupe, stop delivery and deadline, subagent states, usage-limit reset backfill, wire hardening, shadow-home refusal and tool presentation. The code mostly matches the description and the fake-driven scenarios cover it well. I found no high-severity bugs, but three things should change before merge. First, an agentMessage with no phase is treated as a final answer, so on a Codex or model without phases every message after the first stops streaming, and later messages that repeat earlier text are dropped. Second, the probe now runs on every provider refresh, including the usage panel's. Third, subagent stop targeting loses the native turn id. Lows not filed as comments: the cancelled_stops persistent_term entry leaks if the runtime dies before reading it, and every timed-out stop triggers a global persistent_term GC. A persistent tool call whose turn was interrupted is re-finished as completed when Codex later reports it, because state.persistent is never cleared.
Findings (5)
- 🟡 Medium:
apps/server-ex/lib/hal_c2/codex/thread_runtime.ex:1451 — Anything not tagged phase: "commentary" is treated as a final answer. Codex sends `phase…
- 🟡 Medium:
apps/server-ex/lib/hal_c2/codex/thread_runtime.ex:1378 — Every notification on the subagent's thread overwrites :turn_id with params["turnId"].…
- 🟡 Medium:
apps/server-ex/lib/hal_c2/environment.ex:146 — Codex.Provider.load/0 used to run only when refreshModels was set. It now runs on ever…
- 🟡 Medium:
apps/server-ex/lib/hal_c2/codex/provider.ex:168 — The probe starts each instance's app-server without the instance's env (`Settings.instance…
- 🔵 Low:
apps/server-ex/test/hal_c2/subprocess_windows_test.exs:38 — Leftover IO.inspect debug output. The test also adds its temp dir to the global PATH w…
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…g-scenarios
# Conflicts:
# apps/server-ex/lib/hal_c2/environment.ex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR clears the 70 Codex @backlog scenarios across the MC and the phone. Since 274b883 the only new commit is a merge of origin/main (c9b22bc). git diff --cc is empty, so the merge had no conflict resolutions, and none of the Codex code this PR adds has changed. The only change under the Codex paths is a 2-line tweak in codex_steps.exs, and it comes from main.
None of my previous findings is fixed:
- In thread_runtime.ex:1403/1446/2047, a message with no
phase or phase: null still counts as a final answer.
- thread_runtime.ex:1378 still overwrites the subagent's
:turn_id with params["turnId"].
Codex.Provider.load/0 still runs on every refresh that includes a Codex instance, including the plain usage refresh. The code moved to environment.ex:196-198 when main reworked refresh_providers, but the behaviour is the same.
- The provider probe still starts the app-server without the instance's env or its shadow home.
- subprocess_windows_test.exs still has the
IO.inspect at line 38 and still never restores the global PATH it changes at line 19.
These are already on the PR as comments, so I haven't posted them again. The biggest risk is still the phase handling: with older or phase-less app-servers, normal agent messages stop streaming. Main's rework of refresh_providers (the Antigravity error paths and model refresh) leaves the Codex probe path alone, and I found nothing new in the merge.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… from review
Review of the backlog clearing found messages Codex sends without a phase were treated as final answers (held back, then dropped as repeats), a subagent's turn id was overwritten by notifications that do not carry one, the Codex probe ran on every refresh without the instance's env or shadow home, and it told clients mid-refresh, when an agent being re-read shows no models yet. The turns proof also had no model for the new interrupt, its deadline, and non-protocol output.
A message is a final answer only when Codex tags it final_answer (a scenario now shows two unphased messages with the same text), a subagent keeps its last known turn id (turn.id included), Codex is probed on a model refresh as before but with the instance env and shadow home a turn gets, and the refresh tells clients once every agent is read. The proof maps the stop-id interrupt to the interrupt it is, its deadline to the interrupted end, and invalid output to the app-server exit it follows. Cancelled stops older than a minute are pruned, a non-completed turn end closes its persistent items, and the Windows shim test restores PATH and drops its debug output.
Done by Muse Spark in Muse Code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This round's PR commit (fcb9fe2) answers the five existing review comments. Only messages tagged final_answer are held back now, and unphased ones stream normally. A subagent keeps its last turn id, and turn.id is read too. Codex is probed again only on refreshModels, with the instance env and shadow home. The Windows test restores PATH and no longer prints debug output. Cancelled stops are pruned, and a turn that ends without completing closes its persistent items. My previous review had no findings to re-check. The rest of the range is the merge of main (MCP-over-ACP), not this PR's work. One problem is left: taking the notify out of load/0 means the probe that runs at boot never tells clients what it found, so Codex can stay on "has not been checked in this session yet" until some unrelated notify. I could not run the tests here because the Elixir deps are not installed.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Taking the notify out of load/0 left its other caller, the boot task, silent: a client that connected while the MC booted kept the unchecked entry ("has not been checked in this session yet") until some unrelated notify. The boot task now runs Provider.boot/0, which loads and then tells clients; a refresh still tells them once, after every agent is read. A scenario covers a client subscribed before the boot check.
Done by Muse Spark in Muse Code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
This PR clears the 70 Codex backlog scenarios on the MC and the phone. The commit since my last review fixes my one previous finding. The boot task in application.ex:99 now runs Codex.Provider.boot/0, which calls load/0 and then Settings.notify_providers/0. So a client that subscribed while the MC was booting is now sent Codex's checked status instead of keeping "has not been checked". A refresh through Environment.probe/2 still sends one notification after all agents are read, so it gets no extra one. HalC2.Settings starts before the boot task in the supervision tree, so the cast always has a process to receive it. The new scenario checks this from the client's side: it subscribes first, runs the boot check, then waits for a config.providers frame that has models. I could not run it: this checkout has no Hex deps, and mix deps.get needs the network. I found nothing new.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|