Skip to content

feat(backfill): log recent CI jobs with original timestamps - #109

Merged
tbhb-agent merged 1 commit into
mainfrom
agent/rebase-ci-backfill-b1-usdhosv06
Nov 24, 2026
Merged

tbhb-agent merged 1 commit into
mainfrom
agent/rebase-ci-backfill-b1-usdhosv06

Conversation

@tbhb-agent

Copy link
Copy Markdown
Collaborator

Why

Jobs that finished before live CI timing deployed have no Loki history.

Behavior change

Set GITHUB_CI_BACKFILL=owner/repo:7 with 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 event and source=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/reconcile to fit the size limit and reuse the existing reconciler client, installation token, entity tags and shared budget at budget.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 report errors=1 in 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 started and 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 in status.

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 //:format and bazelisk run //:gazelle passed. bazelisk test //... passed with Executed 20 out of 34 tests: 33 tests pass and 1 was skipped. The full run includes //:golangci_lint_test and //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

Generated-by: LLM effort=high;harness=codex:0.166.0;model=openai:gpt-6.1-sol;session=sha-256-64:87811731daa659c7;surface=exec
@tbhb-agent
tbhb-agent merged commit f51ae78 into main Nov 24, 2026
8 checks passed
@tbhb-agent
tbhb-agent deleted the agent/rebase-ci-backfill-b1-usdhosv06 branch November 24, 2026 23:24
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