Skip to content

fix(worker): log why a revision's repository authority check failed - #3356

Merged
freeqaz merged 2 commits into
mainfrom
fix-2272
Oct 23, 2026
Merged

freeqaz merged 2 commits into
mainfrom
fix-2272

Conversation

@freeqaz

@freeqaz freeqaz commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

Before it commits the active pointer, finalizeRevision checks a repository revision's authority again. When that check fails with anything other than a repository authority refusal (an IAM outage, say), the pass retries with DEPENDENCY_UNAVAILABLE but drops the error. Its worker.completed line then has no cause, on a plain retry and on an exhausted one. docs/reference/controller.md says a failed or deferred version pass adds cause, and a failure caught during dispatch already does. #3352 made the exhausted path log the failure fields; this is the same gap one step earlier.

Change

  • apps/controller/src/worker.ts: the retry branch of that catch now keeps revisionFailureLogFields(error), the same fields a failure in dispatch logs. The permanent RepositoryCredentialAuthorityError branch is unchanged: its code already names the cause. No new log field.
  • tests/integration/postgres-worker-agent-revision-teardown.test.mjs: a new case makes IAM fail only after preparation's own authority check (an activateRevision hook with beforeCommit activation), so only the re-check before the commit fails. It asserts one activation, then DEPENDENCY_UNAVAILABLE and cause: "Error" on the logged retry.

No other catch in finalizeRevision drops an error this way: the post-activation catches already pass failure fields, the stopped-candidate catch rethrows everything except a yielded stop, and the exposure-withdrawal catch is best effort after the outcome is committed.

Verification

  • On main 5c901c0 the new case fails (cause is undefined); with the fix it passes.
  • Teardown file: 32/32 on local PostgreSQL, then 20/20 pinned at 2 CPUs.
  • tsc --build tsconfig.json tests/tsconfig.json, eslint and prettier are clean on the touched files.
  • Internal review approved with no blockers. Its nit (assert the outage starts at activation) is applied.

Risks

Low. Log-only: the outcome, code and queue state are unchanged. One more retry log line carries the existing failure fields.

finalizeRevision checks repository authority again before it commits the
active pointer. When that check failed with anything other than a
repository authority refusal (for example an IAM outage), the pass retried
with DEPENDENCY_UNAVAILABLE but dropped the error, so its worker.completed
line carried no cause, on a plain retry or an exhausted one. Keep the
failure fields from the caught error, as a failure in dispatch does.

A teardown test makes IAM fail only after preparation's own check and
asserts the logged cause (finding 2272).
Count the beforeCommit activations so the case fails clearly if the pass
stops activating before the pointer commit (review nit).
@freeqaz
freeqaz requested a review from a team as a code owner October 23, 2026 20:36
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves existing failure diagnostics when a repository authority re-check encounters a dependency failure.

Example: IAM throws Error during the repository authority re-check before the active revision pointer commits.

  • Before: worker.completed reports DEPENDENCY_UNAVAILABLE without cause.
  • After: The same event also reports cause: Error.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with meaningful regression coverage and passing PostgreSQL CI; behavioral confidence remains at the in-process harness boundary.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored logging repair is outside the ordinary contributor proof gate; supplied validation covers the PostgreSQL worker harness and reports a base failure/head pass, without a shipped-entry-point log artifact.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot identify why the repository authority re-check failed from the revision pass’s completion log.
Reason: The collaborator-authored change restores documented diagnostics without adding configuration, changing authorization, or expanding lifecycle scope.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a documented diagnostic omission with a focused change and no introduced correctness or security defect found.

Priority: P2
Reviewed head: f0a0b84e4cc0c6982178c1eb616e894515d9abf7

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-worker outage trace is supplied; the reported base/head comparison and passing PostgreSQL coverage exercise the real worker with fixture Drivers.
Agent review details

How this fits together

The controller worker consumes durable PostgreSQL revision work, checks authority through selected Drivers, updates lifecycle state, and emits structured completion logs.

flowchart TB
  A[PostgreSQL revision work] --> B[Controller worker]
  B --> C[Revision preparation]
  C --> D[Repository authority re-check]
  D --> E[IAM Driver]
  E --> F[Failure classification]
  F --> G[Structured completion log]
Loading

Technical review

Best possible solution:

Keep the existing authority and retry decisions and attach diagnostics through the worker’s established failure classifier.

Do we have a high-confidence way to reproduce the issue?

Current main visibly discards the caught error at this re-check; the PR reports the new assertion failing on the base and passing with the repair, but this review did not execute tests.

Is this the best way to solve the issue?

Using the existing failure classifier at the catch that loses the error is the smallest complete repair and preserves lifecycle behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2c8835276fe0.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Free Wortley: Raw commit 2fd3d79 adds apps/controller/src/worker.ts:601 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2fd3d7913258; files: apps/controller/src/worker.ts)

Review metrics

Metric Value Why it matters
Production versus test changes Production +7/-4; tests +38/-0 The small production repair reuses existing classification; the added case covers a previously untested failure point.

Labels

Label changes:

  • add P2: Missing completion diagnostics hinder investigation of dependency failures without changing runtime availability or authorization.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Missing completion diagnostics hinder investigation of dependency failures without changing runtime availability or authorization.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 23, 2026, 4:50 PM ET / 20:50 UTC.

@freeqaz
freeqaz merged commit fefa6cd into main Oct 23, 2026
72 checks passed
@freeqaz
freeqaz deleted the fix-2272 branch October 23, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant