The pass keeps when its Runs began, and asks a Run's jobs once (#724, record 0193)

Merged
DO
6d ago
+135-6

User description

Part 2 of 4 for #724. It does not close the issue. Part 1 merged as #751.

What changes

The pass now asks when its Runs began, and keeps what it read, so a Run's jobs are asked once.

  • records.begun: reads the last two pass records. A time is kept for any Run, null for a completed one alone, by Run id and when the attempt started. The earlier record's word stands only for a Run the later does not list. A key listed twice is kept from neither listing.
  • The entry: controller/__main__.py hands the records port began=records.begun(earlier), from pass/1 records each from before the pass. With none, or one that is neither, the port is still asked, with nothing kept.
  • Record 0193: two rows added to its Boundaries, as its Status foretold. Nothing decided changes.

No rule of the Kernel reads began_at yet. That is part 4.

The cold start

Record 0193 says the Factory's repo held 27 Runs on 2026-11-11. That count was mine and it was wrong.

  • The count: GitHub lists 94 dispatched Runs on main now (run.yml 78, approve.yml 16), since 2026-11-09, about 40 more a day, kept 90 days.
  • The effect: one read asks 50 Runs' jobs at most, and a Run past the cap leaves the list not whole, which defers every item. With nothing kept, N Runs take ceil(N/50) passes to read, so every item is deferred for ceil(N/50)-1 passes: 1 today, about 7 in a week, about 19 at 1,000 Runs, at 20 minutes a pass.
  • When: the first pass of the Release that carries this part, and after any two pass records in a row that list no Run, as after an outage. Steady state asks only new Runs.
  • It fails closed: a deferral, never an action.
  • The ruling: the Factory Builder ruled on 2026-11-11 that this part lands as built and the bound follows as its own pull request, with a record amending 0193 that corrects the count: the pass asks the jobs only of Runs for open pull requests. No Release is cut carrying this part while its cold start would defer more than 2 passes.

Checks

  • make checks: OK at 32c5bfcf, which holds main at 07410345.
  • tests.test_adapters, tests.test_controller, tests.test_token_needs, tests.test_steps, tests.test_reconcile: OK at b7093cbd (268 tests); the Controller's again at 32c5bfcf, whose one change is a docstring. Eleven quick modules ran OK at 6e4adf5a (428 tests). The simulators, the hooks' and the tools' modules were not run at the desk: CI's verify is the answer.
  • Mutants of adapters/records.py and of the entry's hand-over, filtered: 133 of 133 killed at b7093cbd. No mutant is stale at 32c5bfcf.
  • gitleaks: no leaks.
  • Size as the Kernel counts a diff: 26,647 characters, 248 lines.

Reviews

Carbon, Muse, Astra, the Claude review and the security pass, each of this part alone against main. Every finding is fixed or answered. Carbon's first run, on 6e4adf5a, ended with no read at its 15-minute limit; it read 32c5bfcf whole.

ReviewerHeadUnread partsBlockingMajorMinorInfo
agy32c5bfcnone0000
muse6e4adf5none0000
astra6e4adf5none0100
claude-review6e4adf5none0032
claude-security6e4adf5none0011
FindingSeverityCriterionWhereWhatDisposition
astra#1majorPR-3tests/test_controller.py:1158The entry test does not protect the first jobs readfixed in b7093cbd: a pass with no record before it is held to hand the port nothing kept and still ask, with the mutant "a pass with nothing kept asks the records port no job"
claude-review#1minornonecontroller/__main__.py:158The pass now asks jobs for 93 listed Runs against a cap of 50, where record 0193 counted 27: the first pass defers every Run, and so does each loss of both recordsanswered: true, and record 0193's 27 was my miscount; 94 are listed now. Said in this body under "The cold start". The Factory Builder ruled on 2026-11-11 that this part lands as built and the bound follows as its own pull request, before any Release carrying this part would defer more than 2 passes
claude-review#2minorPR-3tests/test_adapters.py:1526"Null for a completed Run alone" is held against in_progress only: a null kept for a queued Run survivesfixed in b7093cbd: a null on a queued Run is tried, with the mutant "null is kept for a Run that waits"
claude-review#3minorPR-3tests/test_controller.py:1183No test holds that begun is handed the records placed before the pass and held to pass/1: began=records.begun(previous) survivesfixed in b7093cbd: the records before differ, and a record that is no pass record, one not from before the pass, and none each hand on nothing; four mutants of the hand-over
claude-review#4infononethe changeNot a defect of the change: this reader overwrote the shared scratch folder copy that another read was using, for about two minutesno defect of the change: three of the four Claude reads shared one scratch folder for about two minutes; each redid its results in a folder of its own, and no worktree was written
claude-review#5infononecontroller/__main__.py:10The entry's docstring lists what the pass reads and does not name the jobs read or records.begunfixed in 32c5bfcf for the entry's docstring; the port's sentence on known is main's and is left
claude-security#1minorPR-5tests/test_controller.py:1168The entry's test cannot tell which records begun is handed: the hold to pass/1 and to before now has no test, and three mutants of the hand-over survivefixed in b7093cbd, as claude-review#3
claude-security#2infoPR-3tests/test_adapters.py:1526"Null for a completed Run alone" is tried against in_progress only: a null kept for a record's queued Run survivesfixed in b7093cbd, as claude-review#2

Astra has not read the head that holds the fix for its finding. This part's code was also read inside part 1's first reads, before the split.

🤖 Generated with Claude Code


CodeAnt-AI Description

Reuse recorded workflow run start times across passes

What Changed

  • Reuses valid start times from recent pass records to avoid looking up jobs again for the same run attempt.
  • Uses an earlier record only when the later record does not list that run; duplicate or invalid entries are not reused.
  • Looks up jobs again when a run has no reusable start time or starts a new attempt.

Impact

✅ Fewer repeated job lookups for known runs
✅ Fresh start times for rerun attempts
✅ No reuse of ambiguous run records

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.