Skip to content

Add beacon managed ingest support#154

Open
jqdsouza wants to merge 3 commits into
mainfrom
add-beacon-ingest-support
Open

Add beacon managed ingest support#154
jqdsouza wants to merge 3 commits into
mainfrom
add-beacon-ingest-support

Conversation

@jqdsouza

@jqdsouza jqdsouza commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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 new ingest library batches JSONL from the runtime log (and rotated archives), tracks per-file offsets in upload-state.json, and POSTs authenticated batches to /api/v1/ingest/beacon/events.

New CLI: beacon ingest status, beacon ingest endpoint status, and beacon ingest endpoint upload (30s timeout; surfaces LastError as exit error when managed upload is on). beacon endpoint status prints the same ingest summary and includes managed_upload in 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.

@jqdsouza jqdsouza self-assigned this Jun 12, 2026
Comment thread cli/beacon/internal/ingest/upload.go
Comment thread cli/beacon/internal/ingest/upload.go
Comment thread cli/beacon/internal/ingest/upload.go

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a3cf0e1. Configure here.

}
}
sort.Strings(archives)
return append(archives, path), nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a3cf0e1. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant