Add beacon managed ingest support#154
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues. You can view the agent here.
Reviewed by Cursor Bugbot for commit a3cf0e1. Configure here.
| } | ||
| } | ||
| sort.Strings(archives) | ||
| return append(archives, path), nil |
There was a problem hiding this comment.
Rotation re-uploads rotated log data
High Severity
Upload progress is stored in FileOffsets keyed only by log file path. When the endpoint writer rotates the active JSONL file to runtime.jsonl.1, the archived file is read from offset zero while the saved cursor still points at the active path, so events that were already uploaded from the active file are posted again after each rotation.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a3cf0e1. Configure here.
| } | ||
| } | ||
| sort.Strings(archives) | ||
| return append(archives, path), nil |
There was a problem hiding this comment.
Archive logs ingested newest-first
Medium Severity
Rotated logs are ordered with sort.Strings, which yields runtime.jsonl.1 before runtime.jsonl.2 and so on. The writer assigns .1 to the most recently rotated segment and higher numbers to older archives, so ingest sends newer archived events before older ones instead of chronological order.
Reviewed by Cursor Bugbot for commit a3cf0e1. Configure here.


Note
Medium Risk
Sends endpoint telemetry over the network with bearer auth and persists upload cursors; behavior is well-tested (no upload on status, no cursor advance on failure) but misconfiguration or partial failures could affect what gets uploaded or retried.
Overview
Adds managed cloud ingest for endpoint telemetry: endpoint config can include
managed_upload(enabled, ingest URL, source ID, content retention), and a newingestlibrary batches JSONL from the runtime log (and rotated archives), tracks per-file offsets inupload-state.json, and POSTs authenticated batches to/api/v1/ingest/beacon/events.New CLI:
beacon ingest status,beacon ingest endpoint status, andbeacon ingest endpoint upload(30s timeout; surfacesLastErroras exit error when managed upload is on).beacon endpoint statusprints the same ingest summary and includesmanaged_uploadin JSON via lifecycle status—read-only (no network upload on status).Upload is gated on managed+enabled config, valid login, and only advances cursors after successful posts; malformed lines are counted as rejected without blocking valid events. Tests cover status not uploading, cursor rollback on HTTP/invalid responses, and offset-based incremental reads.
Reviewed by Cursor Bugbot for commit a3cf0e1. Bugbot is set up for automated code reviews on this repo. Configure here.