You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex on Windows records nothing: its sandbox user cannot read the API token or write the spool #302
With Codex's default Windows sandbox ([windows] sandbox = "elevated"), Codex runs hooks as its sandbox account (codexsandboxoffline). That account can run the hook script and reach the recorder on loopback, but it cannot read the API token, which Agentmetry restricts to the installing user. Every Codex event is posted without a key, refused with 401, cannot be spooled because the sandbox account cannot write to the data directory, and is lost. Nothing reports it. Coverage still says Codex is hooked.
Evidence (run inside Codex's own sandbox with codex sandbox -- ..., Codex CLI 0.163)
Check as the sandbox user
Result
whoami
<host>\codexsandboxoffline
Read scripts/agentmetry_ingest.py
allowed
Read apps/orchestrator/.env
allowed
GET /api/v1/health on 127.0.0.1:8000
200
Read the API token file
denied
Write to the data directory (spool)
denied
POST /api/v1/audit/ingest without a key
401
Codex's own log shows every hook as started and completed; the trail received zero Codex events over a week of Codex use.
Why the obvious workarounds are wrong
Granting the sandbox account read on the full API token, or putting the token in Codex's hook config, hands a sandboxed and possibly prompt-injected agent a key that can read the trail and close detections.
Fix
The core mints an ingest-only token (ingest-token, which hooks already prefer) and accepts it on POST /api/v1/audit/ingest only. Every other route keeps requiring the full key.
hooks install for Codex on Windows grants read on that token to Codex's sandbox accounts when they exist.
doctor fails when Codex's sandbox accounts exist and cannot read an ingest token, instead of reporting Codex as covered.
Follow-up: a spool location the sandbox account can write, so events survive a recorder restart.
Verified after #303 merged, inside Codex's real sandbox (codex sandbox -- ..., Codex 0.163):
The sandbox account reads the ingest-only token and still cannot read the full API token.
The real Agentmetry hook runs as that account and attempts the POST; doctor reports [OK] Codex's sandbox accounts can send events with the ingest-only token.
hooks install granting the two sandbox accounts read is sufficient; no group entry is needed.
Two follow-ups found on the way:
The trail file itself is readable by the sandbox. Codex grants its sandbox group read on folders opened as Codex workspaces. When the Agentmetry data directory sits inside such a folder (a source checkout's apps/orchestrator/data), a sandboxed agent can read the trail, including command text where command logging is on. Any agent running as the user could already read it, so this is not new exposure, but doctor could warn when the data directory is inside a Codex workspace, and the docs should recommend a data directory outside source checkouts.
Testing note: quoted paths passed through codex sandbox -- cmd /c "..." arrive mangled and read as access denied. An earlier round of checks here produced false denials that way; every result above was re-run with unquoted paths and direct invocation.
Activity
blitzcrieg1 commentedon Oct 21, 2026
Verified after #303 merged, inside Codex's real sandbox (
codex sandbox -- ..., Codex 0.163):doctorreports[OK] Codex's sandbox accounts can send events with the ingest-only token.hooks installgranting the two sandbox accounts read is sufficient; no group entry is needed.Two follow-ups found on the way:
apps/orchestrator/data), a sandboxed agent can read the trail, including command text where command logging is on. Any agent running as the user could already read it, so this is not new exposure, butdoctorcould warn when the data directory is inside a Codex workspace, and the docs should recommend a data directory outside source checkouts.codex sandbox -- cmd /c "..."arrive mangled and read as access denied. An earlier round of checks here produced false denials that way; every result above was re-run with unquoted paths and direct invocation.