Repository navigation
feat(backfill): log recent CI jobs with original timestamps - #109
Merged
Merged
Conversation
Generated-by: LLM effort=high;harness=codex:0.166.0;model=openai:gpt-6.1-sol;session=sha-256-64:87811731daa659c7;surface=exec
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.
Why
Jobs that finished before live CI timing deployed have no Loki history.
Behavior change
Set
GITHUB_CI_BACKFILL=owner/repo:7with reconciliation configured to start one pass inside the service. An empty variable keeps backfill off. Startup rejects a bad repository or a day count outside 1 to 7, and never prints the value.The pass reads up to 30 workflow-run pages and 3 job pages per completed run. It logs completed jobs inside the window with the live recorder's field names plus
eventandsource=backfill. Each record has the job's completion timestamp. Metrics are untouched.The pass logs its start and exactly one terminal summary. Request failures keep the HTTP code in
status, where 0 means the client returned no HTTP status. A failure ends the pass but doesn't stop the service. Shutdown waits for the pass before closing the store.Decisions
Keep the pass in
internal/reconcileto fit the size limit and reuse the existing reconciler client, installation token, entity tags and shared budget atbudget.Backfill. No new priority.Read repository metadata after the first completed run to get the default branch for the live recorder's event classification. The run supplies its real triggering event separately. Count that metadata request in
pages. Abort on the first claim error and reporterrors=1in the failure summary.Keep a fixed start and end for the pass. Skip missing completion times, jobs outside the window, and existing durable claims.
Deviations from the task
Export an alias for the recorder's job payload and a wrapper around its event classification function. The live recording path keeps its behavior.
Needs human judgment
Deploy with the variable set, watch
ci backfill startedand its terminal line, then redeploy without it. The first runs response shows whether the App has Actions read permission, and a 403 or 404 appears instatus.Confirm Loki accepts records up to seven days old and the collector uses the JSON record time. The collector and Loki settings are unchanged.
Keep the store volume across restarts so durable claims skip jobs after an interrupted pass. A second process fails to open a locked store, and one with its own store can duplicate job logs. Run the backfill inside the service only.
Risk
Tech debt: the page caps can leave history incomplete. The pass has no resume cursor. Claim-before-log follows the live recorder: a crash or logging failure after a claim can lose that record. A later live delivery skips that job's metrics after backfill claims it. The debt tracker records these limits.
Security debt: none added beyond the existing App read path and deployment controls.
Verification
bazelisk run //:formatandbazelisk run //:gazellepassed.bazelisk test //...passed withExecuted 20 out of 34 tests: 33 tests pass and 1 was skipped.The full run includes//:golangci_lint_testand//deploy:deploy_test.The committed-head size check passed on
255d421:pr_size: code=397/400 raw=535/1500.Human steering
Loki only, original timestamps, at most seven days, and no separate process. Keep Mimir, the sweep, App authentication, and the receiver outside this change.
Opened-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;surface=cli
Generated-by: LLM effort=high;harness=codex:0.166.0;model=openai:gpt-6.1-sol;session=sha-256-64:87811731daa659c7;surface=exec
Assisted-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-sonnet-5-5;session=sha-256-64:6507fa80a17e0653;subagent=sha-256-64:654693f7a748f974;surface=cli