Add Codex cloud telemetry setup#150
Conversation
Configure Codex cloud agents to emit prompt-aware OTel into Beacon JSONL and upload runtime logs through the existing cloud GCS shuttle. Co-authored-by: Cursor <cursoragent@cursor.com>
Source Codex cloud metadata before starting the watcher and keep periodic uploads alive after transient GCS failures. Co-authored-by: Cursor <cursoragent@cursor.com>
| metrics: | ||
| receivers: [otlp] | ||
| processors: [memory_limiter, batch] | ||
| exporters: [beaconjson] |
There was a problem hiding this comment.
Rotation drops uploaded telemetry
High Severity
The Codex cloud setup enables beaconjson log rotation on /tmp/beacon/runtime.jsonl, while cloud-watch uploads only the active log file and replaces the entire GCS object on each upload. After a rotate, archived events are never included, and a later upload can overwrite the remote object with just the post-rotation tail, dropping telemetry that was already uploaded.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 392a1ef. Configure here.
Make Codex cloud telemetry rely on project hooks discovered before setup while keeping setup responsible for installing Beacon binaries and uploader support. Co-authored-by: Cursor <cursoragent@cursor.com>
Install Codex hook and OTel config files into all plausible cloud config locations, including /opt/codex, so setup output matches the runtime CODEX_HOME path. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1325e0c. Configure here.
| } | ||
| if os.Getenv("BEACON_CODEX_SESSION_ID") == "" { | ||
| _ = os.Setenv("BEACON_CODEX_SESSION_ID", sessionID) | ||
| } |
There was a problem hiding this comment.
Stale run ID after reset
High Severity
cloud-reset calls seedCloudRunID, which only sets BEACON_RUN_ID and BEACON_CODEX_SESSION_ID when those variables are empty. After startup|resume|clear|compact, a new Codex session_id in hook input can differ while the sandbox still carries the previous run id. resolveRunIDFromLog prefers env over the runtime log, so GCS uploads and object paths can keep using the old run id for the new session.
Reviewed by Cursor Bugbot for commit 1325e0c. Configure here.


Summary
beacon cloud codexsetup and hook generation for Codex Cloud Agents.Test plan
cd cli/beacon && go test ./...cd cli/beacon-hooks && go test ./...cd collector-builder/exporter/beaconjsonexporter && go test ./...Made with Cursor