Conversation
…lout log Codex agent cards can remain without a context (`ctx %`) reading while a worker is active. The root cause is a provider-coverage gap, not one shared telemetry failure: Claude can send an exact reading through a status hook and the renderer independently backfills from Claude transcripts every 15 seconds (`useHive.ts:565-590`), while fleet `tokens`/`lastTool` come from a separate OpenTelemetry input. Codex supplies none of those, but its rollout logs carry `token_count` events with the same accounting. `HiveManager` now exposes the isolated worker `CODEX_HOME` at `<hive>/agents/<id>/.codex`. The main-process poll reads that location rather than the registry's project `cwd`, selects the newest nested rollout, and feeds the latest valid `last_token_usage.input_tokens` / `model_context_window` reading through `HookServer.reportContext()`. The renderer needs no change. The 8-second poll does not walk all rollout history on every tick: the selected path, mtime, size and reading are cached, ordinary ticks stat only the selected file, and discovery repeats after 60 seconds or as soon as the selected file disappears. Codex hook delivery was traced through the shared shim architecture but was not empirically proven here; this fix does not depend on that path. Fleet cost/activity telemetry stays out of scope. Tests: 15 new cases in test/codex-context.test.cjs, including the registry/HiveManager seam and the tail-boundary case. The repository's full `node --test test/*.test.cjs` exits 1 on this platform both before and after this change with the same 19 pre-existing failures.
Contributor
|
✅ Evidence received. Before and after are both attached. Thanks — this is what makes a PR reviewable in one pass. |
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.
What & why
Codex agent cards can remain without a context (
ctx %) reading while a workeris active. The root cause is a provider-coverage gap, not one shared telemetry
failure:
backfill a missing reading (
useHive.ts:565-590).tokens/lastTooldata comes from a separate OpenTelemetry input.token_countevents.The shared Codex hook wiring was traced in the architecture, but hook delivery
was not empirically proven as part of this work. This fix does not depend on
that delivery path.
HiveManagernow exposes the isolated workerCODEX_HOMEat<hive>/agents/<id>/.codex. The main-process poll reads that location ratherthan the registry's project
cwd, selects the newest nested rollout, and feedsthe latest valid
last_token_usage.input_tokens/model_context_windowreading through
HookServer.reportContext(). The renderer needs no change.The 8-second poll no longer recursively walks all rollout history on every
tick. The selected path, mtime, size, and reading are cached; ordinary ticks
stat only the selected file, changed files are re-tailed, and discovery is
repeated after 60 seconds or immediately if the selected file disappears.
Fleet cost/activity telemetry remains out of scope and unchanged.
Type of change
Evidence
Before
The pre-fix candidate was run against a read-only copy of one real worker
rollout. The registry project
cwdreturned no reading, while the agentdirectory happened to work only because the old parser appended
.codexitself:
The regression-first focused run against the pre-fix implementation exited 1:
9/15 tests succeeded and 6 failed, including the registry/HiveManager seam,
the exact tail-window boundary, and cache behavior.
After
The same copied rollout, placed under an agent-home-shaped temporary directory,
was read through the corrected CODEX_HOME contract without reading or modifying
the live session:
The focused command
node --test test/codex-context.test.cjsexited 0 with15/15 tests. Its coverage includes the real
HiveManager.registry()plusHiveManager.codexHome()seam, a tail window beginning exactly after a newline,cache refresh/discovery behavior, and deletion assertions for every test temp
directory.
The repository-wide test command still exits 1 because the base and candidate
both have the same 19 failing test names:
Since this evidence was gathered, the office was restarted with this fix
applied. The third screenshot above is that running app: Dwight's and Angela's
(Codex) agent cards now carry the same context gauge Claude agents already had.
How I tested it
npm ci --ignore-scripts— exit 0; 870 packages installed. npm reported theexisting audit state: 22 vulnerabilities (3 moderate, 18 high, 1 critical).
node --test test/codex-context.test.cjs— exit 0; 15/15.npm run typecheck— exit 0 (node and web TypeScript projects).node --test --test-reporter=tap test/*.test.cjson detached basebdf524e— exit 1; 19 baseline failures.names, with 15 additional successful Codex-context tests.
npm run build— exit 0; Vite retained its existing dynamic/static importchunk warning.
git diff --check bdf524e..HEAD— exit 0.detached base worktree were removed afterward.
Credit
Discord:
X:
Checklist
npm run typecheckcompleted with exit 0.npm run test:focusedis not claimed: the repository-wide test commandremains exit 1 with the same 19 baseline failures. The directly relevant
Node test file completed 15/15 with exit 0.
npm run buildcompleted with exit 0.included.