Repository navigation
Admit versioned fleet attempts once and bind their receipts - #1227
hyperpolymath wants to merge 1 commit into
Conversation
|
Review these changes at https://app.gitnotebooks.com/hyperpolymath/hypatia/pull/1227 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b4ba7987b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with :ok <- source_unchanged(source["path"], data_root), | ||
| :ok <- File.mkdir_p(Path.dirname(path)), | ||
| :ok <- File.write(path, Jason.encode!(conflict) <> "\n", [:append]) do |
There was a problem hiding this comment.
Deduplicate conflicts before appending them
When a versioned row reuses an admitted ID with different bytes, every five-minute scheduler poll reaches this append again because versioned feeds bypass the unchanged-signature fast path. Since the conflict includes a fresh observed_at and no existing-conflict check is performed, one unchanged bad source row produces 288 duplicate records and warnings per day indefinitely; preserve the conflict once per committed/source binding instead.
Useful? React with 👍 / 👎.
| defp receipt_input(data_root, row, opts) do | ||
| event_id = Map.fetch!(row, "event_id") | ||
| located = locate_admission(data_root, event_id) |
There was a problem hiding this comment.
Avoid scanning the entire ledger for every receipt
For every ordinary local or legacy outcome, Receipt.write/3 now calls locate_admission/2, which streams every outcome file and JSON-decodes every row before falling back to the legacy lookup. Consequently each normal append becomes O(total outcome history), and bulk ingestion becomes quadratic as the ledger grows; restrict the exhaustive admission lookup to plausible admission rows or use an indexed/single-row lookup that still detects ambiguous IDs.
Useful? React with 👍 / 👎.
| if signature == previous_signature and not versioned? do | ||
| {0, signature} | ||
| else |
There was a problem hiding this comment.
Stop replaying every admitted row on unchanged polls
Once the fleet file contains any attempt_contract, an unchanged signature no longer short-circuits, so every five-minute poll reimports every historical versioned source row. Each replay invokes FleetAdmission.committed/2, which rereads and decodes the entire outcome ledger, making a stable feed cost O(versioned rows × outcome rows) on every cycle; retain retries only for pending receipts/conflicts or move receipt repair to a bounded pass.
Useful? React with 👍 / 👎.
| System.cmd(executable, ["assail", repo_path, "--output-format", "json", "--quiet"], | ||
| stderr_to_stdout: true | ||
| ) |
There was a problem hiding this comment.
Bound the fleet scanner subprocess
If panic-attack assail hangs on a repository or scanner defect, this unbounded System.cmd/3 call never returns, while the scheduler process and the global fleet-admission lock remain occupied. That prevents all later fleet attempts and every subsequent learning cycle from running until the application is restarted; execute the scanner with a finite timeout, terminate it on expiry, and record the scan as unavailable or failed.
Useful? React with 👍 / 👎.
## Why E0-12 requires one stable producer identity for each actual dispatch attempt. The current runner executes a fix without the ruled start record, then writes outcomes without an event ID. This prevents reliable distinction between separate identical attempts and copies/replays of one attempt. ## What changes - Call the existing canonical `mix hypatia.event_id` once before either executable fix path; validate its documented final output line and reject nonzero generator exits. - Append the exact six-field canonical start to `shared-context/learning/fix-attempts.jsonl` before execution. - Preserve the producer ID and identical serialized outcome bytes across the existing primary/central destinations. - Refuse identity, encoding and required write failures; propagate these failures from parallel children to the parent. - Expand the disposable runner harness and add two cross-repository witnesses using actual producer emissions. - Record the bounded evidence and a **PROPOSED** route/observation decision packet. Production exit 78, the licence refusal branch, outcome qualification and current destinations/callbacks are unchanged. Policy refusals do not become fix attempts. ## Evidence Fleet base: `f1b14e2a352491ff7972f0dfd592bfbb28d2f32c`. Hypatia generator/importer: `d158aed87f76b93e4f291e995bef9f26559c7fb2`. Canonical runtime: Elixir 1.19.4 / OTP 27.3.4.19. - Failing-before controls reproduced missing producer identity, execution without a start, and a parallel infrastructure failure incorrectly returning zero. - Outcome suite: **63 checks pass**, also invoking **112 whole-runner checks**. - Canonical Mix generator: **112 whole-runner checks pass**. - Quarantine: seven blocked entrypoints and the no-publication/state-mutation assertion pass. - Direct-call smoke: **5 checks pass**. - Bash parsing and whitespace checks pass; ShellCheck was unavailable locally. - Actual emitted-row importer witness: **3 checks pass**, including distinct attempt IDs, exact mirrors, start exclusion, persisted replay deduplication and no implicit qualification of raw monthly rows. - Existing Hypatia importer/event-ID regression suite: **56 tests, 0 failures**. - Independent source/document review found and resolved the parallel failure propagation issue and confirmed the final bounded patch. Exact commands, limitations and witness reproduction are in `docs/operations/NS-02-producer-identity.adoc` and the companion decision packet. ## Unresolved integration boundary — deliberately visible **The route counterexample exits 1.** One actual emitted failed attempt becomes **two qualified failures with two receipts** if its current direct Mix recording is followed by explicit fleet import. The `bot=hypatia` echo alone is skipped; the duplicate comes from admitting the independent direct record and the producer record. This falsifies naïvely forwarding the current monthly outcome into E0-11 while retaining independent direct recording. It does **not** demonstrate automatic delivery, and the artificial dual-call diagnostic is not a universal acceptance test for a future exclusive-ingress design. E0-12's stop condition requires a design for multiple outcome rows from one attempt. The May dispatch contract simultaneously requires `mix hypatia.record_outcome`. The proposed resolution is the existing trusted importer as the sole attempt admission path, with rescans as explicitly correlated evidence and at most one effective qualified contribution per attempt. Existing success, failure and qualified-false-positive accounting must be preserved. At this historical producer revision, the route had not yet been changed. The owner has since approved sole fleet admission; the implementation is in the follow-on drafts linked below. ## Scope This draft supports review of the producer identity contract. It does not close E0-12/E0, remove quarantine, change public admission, deploy anything, prove power-loss durability or exactly-once neural updates, or qualify a higher Kautz type. The owner direction is now approved. Full route closure remains subject to the follow-on integration and post-fix attribution gates described below. ## Hosted CI checkpoint — 23 November 2026 [Dispatch path and outcome contracts](https://github.com/hyperpolymath/gitbot-fleet/actions/runs/45150891982/job/137611681951) passed. Wider CI remains blocked and incomplete. [Pinned source closure](https://github.com/hyperpolymath/gitbot-fleet/actions/runs/45150891940/job/137611681178) failed with `SOURCE-ACTIVE-MISSING`: `scanner-credential` calls Hypatia's reusable workflow at `f2c06048…`, but the active source catalog and closure receipt still bind it to `29a9e4a8…`. The source auditor's 55 fixture controls passed; actual source authentication did not. The dependent [E2E job](https://github.com/hyperpolymath/gitbot-fleet/actions/runs/45150891940/job/137611995270) stopped at its prerequisite guard before checkout or behavioral tests. This is one source-closure blocker plus its propagation, not evidence of a second behavioral regression. Independent comparison confirmed that the workflow tree, auditor, catalog and receipt are unchanged from this PR's base. The actual patches in [existing maintenance PR #707](https://github.com/hyperpolymath/gitbot-fleet/pull/707/files) repair the two stale bindings. That lane owns the fix; it has not been duplicated here. Its patch does not yet establish that subsequently skipped checks will pass, and this PR remains draft. No gate was weakened or rerun. ## Approved single-admission follow-on — 23 November 2026 Jonathan approved the existing trusted fleet importer as the sole admission path, with rescans as correlated evidence. The reviewed implementation is in [fleet #710](#710), paired with [Hypatia #1227](hyperpolymath/hypatia#1227). This #709 head remains the bounded historical identity patch and counterexample; its code, CI history and quarantine have not been rewritten. The new paired witness exercises actual feed delivery without a copying step, preserves four start/source/outcome/receipt identities and checks all four receipts with Nickel. Current mutable-target scans remain unbound and confer no positive credit or false-positive blame. The matching consumer must precede producer activation. Both follow-ons remain drafts; no activation or E0/Kautz sign-off is implied. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Operational Changes** * Dispatch attempts now require a valid attempt identifier before execution. Failures to create or record attempt details are reported as dispatch errors. * Outcome records can include the attempt identifier. A failed central-store mirror is reported even when the primary record was saved. * **Documentation** * Added guidance on producer identity and a proposed outcome-routing decision. The proposed route change is not implemented, and production dispatch remains quarantined. * **Tests** * Expanded coverage for dispatch, event identity, outcome recording, and import behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude <noreply@anthropic.com>
) ## Why The old runner's monthly outcome copies did not reach Hypatia's fleet import feed. Independently recording an attempt and then importing it could create two qualified contributions. Jonathan approved sole fleet admission with correlated rescan evidence on 23 November 2026. This implements the producer half, stacked on #709. The matching consumer is [Hypatia PR #1227](hyperpolymath/hypatia#1227), commit [4b4ba79](hyperpolymath/hypatia@4b4ba79); deploy and configure that consumer before any producer activation. ## Change - Emit `attempt_contract: fleet-attempt/1` and the normalized actual `repo_relative_path`, retaining #709's canonical event generation and six-field pre-execution start. - Append the actual configured fleet feed first, then identical raw transport mirrors under `dispatch/fleet-outcomes/`, outside the canonical learning ledger. - Make **zero** independent `mix hypatia.record_outcome` calls for identified attempts. The separate policy-refusal callback retains its legacy behavior. - Coalesce physical destination aliases; reject start/outcome collisions and known outcome/receipt-ledger pollution, including hardlinks. - Propagate feed/mirror and parallel infrastructure failures. A mirror failure retains the committed feed row without rerunning the fix or minting a new ID. - Preserve the production quarantine and licence gate. Mark #709's earlier behavior/evidence as historical and record the approved contract and pairing requirements. ## Validation - Outcome controls **63 / 0**; actual-runner harness **189 / 0**. - The same 189 assertions pass using the real canonical Mix event-ID generator. - Quarantine controls pass; refusal smoke **5 / 0**; Bash syntax and whitespace checks pass. - Independent producer source review found no blocker. - New actual-delivery witness **1 / 0** on both the matching consumer and its separately validated NS-01/NS-03 combination. The runner creates the import feed itself, with no delivery-copy setup. Four source/start/outcome/receipt IDs match; two failures qualify and two unbound success assertions stay audit-only; replay does not rescan or recount; all four receipts pass Nickel 1.11.0. - Failing controls demonstrate the old producer's absent feed and the old consumer's unjustified success credit. The integration fixture uses a controlled fixer and scanner subprocess. It tests the actual delivery and interpretation boundaries, not production scanner effectiveness. ## Integration limits Older E0-11 consumers ignore the new marker. Matching code versions and physical fleet/repository/store roots are prerequisites; a producer cannot verify an independently configured consumer's undisclosed roots. Existing fleet CI jobs run shell contracts, not the paired consumer witness. #709's inherited source-closure, RRA Clippy and GSBot dependency issues are already owned by #707; this change does not duplicate or suppress that lane. ShellCheck was unavailable locally. This is a draft integration step. It does not activate dispatch, remove quarantine, bind mutable post-fix state, implement revisions or establish full E0/Kautz qualification. Detailed evidence and commands: [NS-02-single-admission.adoc](https://github.com/hyperpolymath/gitbot-fleet/blob/37ea58c5b577485de9dc1e2af46af1d09e7056e6/docs/operations/NS-02-single-admission.adoc). --------- Co-authored-by: Claude <noreply@anthropic.com>



Why
Connecting the old direct-record callback and fleet import allowed one executed attempt to become two qualified failures with two identities. Jonathan approved the existing trusted fleet importer as the sole admission path on 23 November 2026, with rescans retained as correlated evidence.
This is the consumer half of that approved route. It is stacked on #1224 so the already reviewed dependency repair remains outside this diff. The matching producer is gitbot-fleet PR #710, commit 37ea58c.
Change
fleet-attempt/1from the actual configured feed, checking the source row's exact bytes, digest, locator and producer identity before constructing consumer-owned metadata.The May dispatch contract is explicitly amended. No public trusted-ID switch is added.
Validation
The first broad run exposed an existing Kin timeout fixture's dependence on a previously blocked application cohort. A deterministic red/green control now uses owned real cohorts under the default Coordinator name, preserving the strict readiness barrier and all production guards. That test-only isolation repair is included and documented separately.
Boundaries and integration
The matching consumer must precede producer activation: older readers ignore the version marker and can still credit a producer assertion. Pair the actual fleet, repository and learning-store roots.
The local lock covers one BEAM VM. Trusted destination storage, post-fix snapshot attribution, revisions/withdrawals, qualified model updates and full E0 acceptance remain separate requirements. NS-01/#1222 and NS-03/#1223 are compatibility-tested dependencies, not merged by this PR. Quarantine and activation authority are unchanged; no Kautz promotion is claimed.
Detailed contract and reproducible evidence: fleet-attempt-admission.adoc and NS-02-fleet-admission.adoc.