Skip to content

fix(models): preserve legacy catalogs after failed refreshes - #158113

Merged
steipete merged 8 commits into
mainfrom
codex/models-discovery-outcomes-20260925
Sep 25, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/models-discovery-outcomes-20260925

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Legacy provider plugins can return catalog rows without explicit discovery outcomes. After a provider-wide refresh failure, previously acquired models could disappear or be replaced by configured starter rows; a second failed refresh could also discard inventory retained after the first.

User Impact

Keep previously acquired, nonempty legacy model rows through repeated provider-wide failures under unchanged source and credentials. Preserve case-distinct model IDs and registered provider aliases. A first discovery failure still uses configured starters, and a successful empty replacement does not resurrect old inventory on a later failure.

Why This Change Was Made

The existing catalog acquisition scope now captures the identities actually returned by an accepted runtime hook, before static fallback and configuration merging. The worker projects those identities onto its existing pre-augmentation registry routes and carries the private row facts into the inventory's existing provider bindings. The publication owner retains only matching prior published rows, preserving their metadata over a failed fallback while allowing distinct configured and supplemental rows to refresh.

Public optional outcomes keep their existing meaning: no discovery-success event is inferred, no plugin SDK contract changes, and no new persisted state is added. Explicit outcome, credential, profile, source, scope, and lifecycle checks remain authoritative. The earlier inferred-success candidate was withdrawn; canonical scoped-alias handling and explicit-success HTTP fixtures are preserved. Other feature PRs do not depend on this separate compatibility repair.

Evidence

  • The real worker regression failed twice on the earlier completion-map candidate: a second unavailable result lost learned rows, and configured-only acquisition retained stale supplemental rows.
  • The corrected real-worker suite passes all four cases, including the original native-harness control, case-distinct legacy rows, repeated failures, alias-only results, failed fallback metadata, fresh configured-only augmentation, and successful empty replacement followed by failure.
  • The final four real-worker cases plus 132 unchanged owning/sibling cases pass: 136 distinct cases covering publication, scoped refresh, static startup, explicit outcomes, SDK acquisition expiry, and the complete 26-case OAuth/auth-order fixture. Production and owning test compilers, changed-file lint/format, all three unused-export scans, structural guards, and both runtime/type-inclusive cycle checks pass. Fresh cumulative and independent source reviews are clean.

The previous narrowed head completed hosted CI successfully. Review then identified the two row-provenance gaps above; that success is not used as proof for this successor. Earlier local test failures from an incorrect supplemental-row expectation are retained: explicit failure intentionally filters unconfigured augmentation, and the corrected test checks freshness through a genuinely configured-only physical route instead. No production filter, timeout, or assertion was weakened.

Local proof uses macOS, Node 24.21.0, and the maintained wrapper with one worker and isolated synthetic state. It does not claim Linux or live-provider equivalence. The inherited 721/720 local shard failure is resolved by carrying the exact canonical two-file session-root split from d07b710. The boundary guard and both affected graphs pass without changing limits, compiler settings, or coverage. Current-head hosted gates remain required.

Record successful legacy catalog results at the producer boundary so unavailable refreshes retain the accepted inventory. Preserve explicit outcomes, advisory SDK fallback behavior, and first-discovery starter policy.
@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 12:43
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

This is the existing repair for the model-inventory failures blocking #158102; I inspected the actual eight-file diff at aef8743b208c23d52f6a7f903cb6366f54ae30fd and am not creating a competing patch.

Observed in exact-source-bound PR merge CI b5882e015854140c56bbec76cc787ce593fd9f57:

  • Discovery lifecycle job: initial learned rows were acquired at line 182; the degraded refresh at line 187 returned [].
  • Freshness job: three variants lost previously published rows after an unavailable refresh at line 265.

Both successful legacy hooks omit optional outcomes, so the old producer did not record successful discovery origins. The first-failure starter protection then cannot distinguish previously learned legacy rows from never-discovered fallback rows. This PR supplies the producer fact without removing that protection or weakening auth checks, and keeps explicit/advisory outcomes authoritative.

Our source-owner blobs match the CI base and merge. Independent real-flow qualification is not claimed: the bounded local replay failed earlier at fixture admission, and the baseline/freshness control was stopped by the runtime-preparation guard before execution. No guard or credential boundary was bypassed. The already-merged #157487 repairs a different commands-probe fixture and is not counted as this fix.

I am keeping #158102 limited to its proven coauthor-fixture routing change and will reconcile its CI context against this owning repair once qualified/landed. The unchanged real Gateway discovery/freshness fixtures are the relevant after-fix evidence to retain.

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 2:16 PM ET / 18:16 UTC (Revision 9).

ClawSweeper review

What this changes

The branch records model identities returned by legacy plugin catalog hooks, retains matching rows across failed refreshes, adds documentation and regression coverage, and rebalances agent test typecheck roots.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open. Current main can discard previously acquired legacy models after a failed refresh, and the current branch addresses the two provenance defects raised in the previous review. The related merged catalog PRs fix different behavior.

Priority: P1
Reviewed head: 16012de251ec54cc2b18ebd8091f42fdaf3c8e79

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The current patch uses the existing owners and provides direct worker-path regression evidence for the previously identified gaps.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.
Evidence reviewed 8 items Current main retains only explicit discovery origins: The publication path on current main requires a prior ready origin before retaining rows after failure; it has no legacy-row provenance.
Introduced acquisition provenance: The runtime hook records returned model IDs before configured models are merged; the worker maps accepted IDs to registry route rows before augmentation.
Repeated-failure retention: The publication owner carries prior legacy row keys through a failed refresh and applies the existing credential, profile, and outcome checks before reusing rows.
Findings None None.
Security None None.

How this fits together

Provider plugins supply model catalogs to a prepared worker. The catalog publication owner combines those results with configuration and prior inventory before agent model selection.

flowchart LR
  A[Provider catalog hook] --> B[Prepared catalog worker]
  C[Configured models] --> B
  B --> D[Catalog publication]
  E[Prior inventory and credentials] --> D
  D --> F[Published model choices]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +156, Tests +386, Docs +5. Total +547 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 7 181 25 +156
Tests 10 419 33 +386
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 605 58 +547

Review metrics

Metric Value Why it matters
Production and test LOC production +156 net, tests and test support +386 net The production growth implements private row provenance in the existing worker and publication owners; the larger test change exercises failure sequences and aliases.

Stored data model

Persistent data-model change detected: serialized state: src/agents/test-helpers/prepared-model-catalog-legacy-fixture.ts, serialized state: src/agents/test-helpers/prepared-model-catalog-worker-fixture.ts, unknown-data-model-change: src/agents/test-helpers/prepared-model-catalog-legacy-fixture.ts, unknown-data-model-change: src/agents/test-helpers/prepared-model-catalog-worker-fixture.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep legacy-row retention in the existing catalog publication owner, scoped to unchanged provider source and credentials, while explicit outcomes and fresh configured rows remain authoritative.

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

Yes, at source level: a legacy hook can return nonempty rows without outcomes, then a provider-wide failure reaches current main's guard that rejects rows with no prior ready origin. This read-only review did not run the scenario.

Is this the best way to solve the issue?

Yes. Private acquisition provenance in the existing worker and publication owner preserves the rows without inventing public successful-discovery outcomes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cc9ddc979237.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove merge-risk: 🚨 auth-provider: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A failed provider refresh can remove previously acquired model choices from an active agent workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix macOS run of a synthetic legacy plugin through the production prepared-catalog worker and publication path: learned rows survive consecutive injected failures, configured rows refresh, aliases resolve, and a successful empty replacement clears retention. The source fixture exercises those cases; this read-only review did not rerun it. The added row provenance is in memory, so no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-25T12:55:33.921Z sha aef8743 :: blocked before merge. :: [P2] Keep skipped catalog paths out of synthetic ready outcomes
  • reviewed 2026-09-25T13:27:23.847Z sha aef8743 :: blocked before merge. :: [P2] Keep skipped static catalogs out of ready outcomes
  • reviewed 2026-09-25T14:01:22.083Z sha 5d9c2d7 :: blocked before merge. :: [P2] Keep SDK static catalogs out of live discovery outcomes
  • reviewed 2026-09-25T14:37:25.835Z sha 4f1acb7 :: blocked before merge. :: [P1] Preserve the documented live-discovery boundary
  • reviewed 2026-09-25T15:18:10.353Z sha 4f1acb7 :: blocked before merge. :: [P1] Preserve advisory legacy catalogs without synthesizing ready outcomes
  • reviewed 2026-09-25T15:46:07.575Z sha b9d11a8 :: blocked before merge. :: [P1] Keep legacy rows through consecutive failed refreshes | [P1] Keep starter fallback for configured-only worker results
  • reviewed 2026-09-25T16:10:46.561Z sha db095ab :: blocked before merge. :: [P1] Preserve legacy rows through consecutive failed refreshes | [P1] Exclude configured-only worker rows from legacy retention
  • reviewed 2026-09-25T16:35:35.222Z sha db095ab :: blocked before merge. :: [P1] Preserve legacy rows through consecutive failed refreshes | [P1] Exclude completed configured-only rows from legacy retention

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@steipete — the dependency is still blocked at aef8743b: CI job 108077525377 reports 54 auth-provenance outcome-array failures, and the current review identifies skipped/static Hugging Face and Arcee paths that still need explicit no-discovery outcomes. These failures do not by themselves establish a credential-isolation bypass.

I can address that remaining scope on this existing branch if you want to hand it over, preserving the legacy-success fix, auth assertions, and unchanged Gateway retention fixtures. I will not push to your branch or create a duplicate repair without that handoff. Otherwise I will keep the dependent #158102 unchanged until your corrected revision is qualified and lands.

Mark bundled static, configured, and advisory catalog projections with
explicit empty outcomes so legacy success inference cannot promote them
to observed account inventory. Preserve live outcomes and helper types.

Keep exact auth provenance histories and move existing fixture/policy
code into focused owners where required by the line-cap ratchet.

Validation: 447 producer and sibling cases, 56 shared self-hosted cases,
95 auth/policy cases, causal missing-outcome failures, maintained checks,
and independent review.
@steipete

steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the shipped-contract concern in b9d11a8. The blanket absent-outcomes-to-ready inference and its producer-marker/caller changes are removed. Returning advisory or legacy provider configuration no longer creates a public success outcome or changes account-visible supplemental-row filtering.

The remaining fix is confined to the existing catalog publication owner: previously completed, nonempty legacy inventory without an outcome can survive a provider-wide failure under unchanged credentials. Configured/native-first startup rows, empty legacy results, profile-specific failures, and changed credentials keep their existing guards. Canonical scoped-alias handling and the explicit HTTP-success fixture fixes remain intact.

The causal baseline fails only this legacy-retention case (1 failed / 6 controls passed). The final catalog-owner suite passes 28/28, scoped-refresh/publication siblings pass 37/37, and the unchanged native-worker integration retains its supplemental proof row. Fresh independent review is clean. Current-head CI remains required; the PR body records the unchanged local 721-root shard-limit refusal and the passing direct compiler/lint/structural checks.

@steipete
steipete marked this pull request as ready for review September 25, 2026 15:38
steipete added a commit that referenced this pull request Sep 25, 2026
* fix(doctor): report remaining systemd units after cleanup

The confirmed unit's disable result does not establish that no other
canonical or legacy user unit remains. Consult the existing scoped
installation discovery passively after cleanup and report remaining or
unverifiable state without deleting another unit.

Keep the successful removal distinct from a later inspection failure, and
limit clean wording to the supported matching installed-unit search.

Add causal Doctor-boundary regressions for a surviving alias and failed
post-cleanup inspection. Native transport and uninstall are mocked; the
selected synthetic file is actually removed and legacy bytes stay intact.

Follow-up to #119674.

* test(doctor): distinguish readers from staging workers

Reuse the canonical startup pending-read correction while preserving selected-unit reporting and cleanup scope.

(cherry picked from commit 9b90a98)

* fix(models): integrate canonical discovery provenance repair

Compose the qualified catalog correction from #158113, including explicit static and advisory outcomes and exact auth-provenance expectations. Include its existing first-discovery retention prerequisite; preserve the independent Doctor reporting change.

Canonical commits: aef8743, 5d9c2d7, 36def8b.

* fix(ci): finish canonical catalog and Doctor integration

Preserve the landed Doctor mock lifetime cleanup while composing the catalog loader type leaf and generated non-live catalog outcome correction. Reader and staging assertions, strict live discovery, and custom callbacks remain unchanged.

Canonical commits: cbff337, 9adf333, 4f1acb7.

* fix(ci): withdraw catalog inference detour

Restore the task-created catalog changes to fixed canonical main168d454d while preserving scoped outcome handling from #158139 and the real HTTP fixture correction from #158115. Keep the service-reporting repair and canonical pending-read assertions unchanged.

The previous inference changes introduced a compatibility and native augmentation regression. Their failure history remains documented; the separate legacy-retention repair is not a dependency of this feature.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 25, 2026
Supply an empty completed-provider map when reusing a prior publication. The existing ready/profile origin must authorize retention; the fixture does not claim legacy acquisition. Preserve all OAuth preparation and no-HTTP assertions.
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 25, 2026
@steipete
steipete marked this pull request as draft September 25, 2026 16:26
steipete added a commit that referenced this pull request Sep 25, 2026
* fix(gateway): cancel pending model reloads during shutdown

Carry the managed reloader lifetime into model acquisition so shutdown
signals cancellation before joining active reload transactions. Preserve
publication observer timeouts and final raw acquisition/disposal joins.
A stopped caller can leave successor observation without cancelling that
successor, and cancelled queued refreshes reject instead of reporting success.

Prove the real Gateway watcher/close boundary and preserve model owner,
write-settlement, dispatch, metadata, and original-order config behavior.
The historical include-only hook timeout remains causally unproven.

* fix(gateway): preserve shared model refreshes until final shutdown

Move acquisition cancellation to the existing metadata lifetime's shared
producer stop after every admitted Gateway fences admission. A closing
sibling must not cancel a publication still needed by a live Gateway.

Seal late refresh admission using the existing model controller and epoch,
reset it only for a new registered model lifetime, and preserve published
leases and final raw-work joins. Remove the superseded caller abort options
and publication-observer changes.

Prove final, surviving, and concurrently closing Gateway behavior, booting
owners, duplicate close, and raw cleanup; 201 selected cases pass. The
historical include-only hook timeout remains causally unproven.

* test(gateway): complete web-fetch startup model teardown mock

* fix(gateway): retain model cancellation before bootstrap

* fix(models): compose canonical catalog provenance repairs

Carry the canonical starter-retention prerequisite and #158113 through
4f1acb7 so legacy discovery success has provenance while advisory,
authored, and skipped catalogs remain explicit non-observations.

Preserve the Gateway lifetime repair and its raw acquisition cleanup joins.
The historical config hook timeout remains unlocalized.

Validation: 98 composed catalog/auth/Gateway tests, 24 scoped-refresh cases,
18 provider-entry cases, full changed checks plus final targeted type/lint
checks, zero Madge cycles, and fresh independent P2 review all pass.
Package Acceptance remains source-bound to 5414519.

* fix(gateway): keep shutdown repair on canonical catalog contracts

Remove the unlanded catalog inference and producer-marker changes while
preserving the qualified shared Gateway cancellation and cleanup owner.
Retain canonical starter handling, captured provider scope normalization,
and explicit successful discovery in the real HTTP lifecycle fixtures.
The separate legacy-retention proposal is not part of this change.

Validation: the unchanged native-worker regression and scoped/HTTP catalog
flows pass all nine tests. The shutdown files retain the qualified 541
behavior and source-bound Package Acceptance evidence. Maintained changed
checks and independent P2 review pass; canonical dependency postimages
match main at 168d454 without a broad source or manifest refresh.

* test(gateway): report config fixture phase on failure

Temporarily record the current setup and teardown steps of the existing
config RPC fixture and emit them only when its test fails. Preserve the
original assertions, hook order, deadlines, imports and cleanup joins.
This observes the recurring CI hook timeout; it does not claim a repair
and will be removed from the landing candidate after localization.

Validation: root test typecheck, targeted lint/format, line-cap and diff
checks pass. Independent P2 review confirms the observer contract against
the installed Vitest runner. No runtime retry or timeout relaxation.
steipete added a commit that referenced this pull request Sep 25, 2026
* refactor(sessions): reconcile hydration with current worker context

* fix(sessions): remove unused hydration worker type export

Keep the hydration input private to its shared worker union owner while retaining the externally consumed SQLite target input export. This clears the unused-export finding without changing emitted runtime code.

* fix(sessions): publish transcript projections through canonical workers

Move deferred projection writes and readiness reads onto the existing worker
owners while preserving compressed transcript bytes, navigation, and FTS
identity maintenance.

Join the exact in-progress database close before readiness re-admission.
Preserve finalized receipts when retirement prevents a new orphan sweep;
the next preflight still repairs derived orphan rows.

Validation: 73 focused cases, 16 current-main composition cases, causal
SQL control, complete supported lint stripes and selected guards, current
union types, and independent P0-P2 feature and lint-delta reviews.

* fix(sessions): stream full hydration within worker memory limits

Transfer canonical transcript chunks through the existing history worker while retaining one read-only snapshot and complete caller-side results. Preserve SQLite text encodings, BOM errors, cancellation, current-owner checks, and native cleanup without raising the worker heap limit.

* fix(sessions): preserve deferred projection ownership

Carry the admitted database environment through post-commit publication.
Register the projection worker protocol and route its test consumers through
the host broker. Synchronize cancellation and planner fixtures with the real
projection task and completed reconciliation owner.

* test(sessions): align hydration error controls with streaming

Model interactive admission and the canonical streaming result in the
existing quarantine error fixture, preserving its cleanup and retirement
assertions. Remove a redundant unknown-alias assertion from the reader;
emitted production JavaScript is unchanged.

The complete 21-case worker error file, assertion ratchet, owning types,
scoped lint, and fresh P0-P2 review pass.

* fix(sessions): preserve maintenance publication and CI ownership

* test(sessions): preserve projection worker ownership

* test(sessions): drain rewrite fixtures before removing inputs

* test(gateway): keep history worker tests with their canonical owner

* fix(sessions): preserve projection wait cancellation errors

* test(gateway): drain transcript reader fixtures before cleanup

* test(gateway): match the landed placement policy fixture

* fix(gateway): preserve transcript event source ordering

* fix(sessions): refresh stale discovery within captured authority

Refresh pure physical-target discovery once when registry facts change, keeping source retirement and worker failures terminal. Align Gateway fixtures with shared-state and projection lifetimes while preserving their assertions.

* fix(sessions): resume scoped reads after healthy verification

Start a new topology read with current admission for the original physical database and captured owner scopes. Keep startup reads sticky and reject old replies, replaced files, and expired maintenance or schema scopes.

Allow bounded accepted exact-row facts to materialize while their page remains pinned. Preserve foreground priority for new worker reads and the existing archive and source guards.

Update request-authority fixtures to hold the real worker snapshot, and carry the canonical updater VM fixture repair from 691d2e5.

* test(gateway): capture the published chat fixture store

* test(gateway): exclude test support from production callsites

* test(ci): compose canonical fixture repairs

Retain the actual coalescing assertion alongside the canonical capped-chunk comparison. Keep native routing entries sorted without changing membership, preserve the older-schema fixture index lifecycle, and include the existing plugin disposal module in wrapper closure.

Canonical fixes: cb3e6df.

Co-authored-by: joshavant <[email protected]>

* test(ci): preserve shard coverage across planner formatting

Retain canonical gatewayPatterns factoring from 449fc2e and move the
unchanged coalescing assertion earlier in the same case. This resolves the
actual one-file main conflict without importing unrelated source or changing
coverage, ordering inputs, capacity checks or dependencies.

Validation: exact assertion byte parity and clean three-way file union;
owning case, root-test types, scoped lint/format and P2 review pass.

* test(sessions): qualify publication through physical replacement

Hold the real committed finalizer reply before host delivery. Prove that
canonical close waits for the original notification, then replace the closed
physical file and verify the successor contains only its own transcript.
Reuse the existing publication fixture and transparent worker-operation
interception; preserve all native admission and cleanup parameters.

The new case closes the final-effect proof gap without changing production,
adding a Gateway boot, or using a timer or test-only production hook.
Validation: six publication cases pass; new case 1.766s, wrapper 85.48s including
compilation. Owning types/lint/format, ratchets and independent P2 review pass.

* test(ci): compare precise plans with their canonical templates

The UI fallback fixture compared precise parent-job metadata with a measured
complete plan that intentionally repacks different siblings. Compare each
branch with its actual canonical producer and retain all coverage, uniqueness,
worker, runner, concurrency, fallback and memory assertions.

The original two-worker-vs-undefined parent environment mismatch reproduced.
Adding changed-path context alone still failed; matching the precise template
owner passes in 59.79s wrapper wall. Root-test types, lint/format, both ratchets
and independent P2 review pass. No production limits or policy changed.

* perf(cli): reuse pinned config for proxy validation

Carry the exact canonical correction from 488ce1e (#158071), preserving its guarded fallback to the same synchronous config getter. All 73 owning CLI tests, core and config-CLI types, scoped lint/formatting and managed P2 review pass on this composition. The historical 30-second CI timeouts remain unattributed; this is a measured cold-import improvement, not proof of their cause.

* test(ci): align precise assertions with canonical runtime inventory

Adopt the canonical 88e2ebe template reference and explicit deferred-runtime exclusion, retaining changed-path context for the dedicated UI comparison. Preserve all capacity and coverage assertions. The exact three-way file union is clean; the owning case, root-test types, lint/formatting and managed P2 review pass. No production or dependency changes.

* fix(models): preserve explicit catalog discovery provenance

Compose the reviewed #158113 successor 5d9c2d7 and canonical 36def8b consumer. Record successful legacy results while keeping bundled static and advisory results explicitly non-discovery. Preserve the strict retention rule and original worker/source authority. All 40 postimages match the supplier; focused composition tests, types, lint, formatting, ratchet and managed P2 review pass. Matching canonical producer/freshness proof is reused with its original source binding.

* fix(plugin-sdk): compose explicit static catalog outcomes

Compose the qualified six-file successor from #158113 at 4f1acb7. Preserve strict discovery and mark generated static catalogs as non-discovery; move the loader type to its canonical leaf without changing its public export. All six postimages match the supplier. The 18-case owner file, core and SDK types, lint, formatting, both cycle guards, and managed P2 review pass.

* refactor(state): separate independent read byte accounting

Relocate the unchanged deletion snapshot and journal clauses after the repository selector clause so canonical cron byte accounting can merge without an insertion collision. Exact formulas, command discriminants, source authority and input capture are unchanged. The 35-case worker owner suite, core types, lint and formatting pass; managed P2 review is clean and the exact fixed-main file union preserves all clauses.

* fix(models): compose captured discovery alias scope

Compose canonical #158139 (52fc3da) with the qualified #158113 catalog correction. Preserve captured alias normalization only for outcome filtering, original hook scope, explicit outcome authority, and single evaluation of accepted legacy projections. Clarify the legacy omitted-outcome compatibility exception in the combined documentation. All 16 alias/legacy controls, core and owning types, lint/formatting, both cycle guards and managed P2 review pass.

* fix(models): remove unlanded catalog inference detour

Restore all 43 differing detour paths to canonical main52fc3daa84f71b15a052f7bd60caa7096ed5b31a, as verified against the canonical reversal manifest. Preserve the Projection implementation, strict36def retention consumer, canonical alias scope, and #158115 validated HTTP-success fixture correction. The separate legacy-retention repair is not imported.

Validation: 45 native-worker/catalog-builder cases pass; the original discovery lifecycle and credential-free full-refresh cases pass. Core and three owning type projects, scoped lint/formatting, both cycle guards and managed P2 review pass. The longer native Gateway tour reached its final proof marker then hit its unchanged120-second deadline during cleanup, followed by one shutdown cascade; that gap is retained without a retry or deadline change. Current-head CI and installed-upgrade proof remain required.

* fix(gateway): compose early model shutdown cancellation

Compose the exact qualified nine-file shutdown correction from #158047 at541451990b7395eb25c449f0f3a4d4106004e601. Retain cancellation before bootstrap and join the shared prelude only after admitted Gateway owners fence new work. Preserve main's heartbeat-before-cron ordering and all original Projection publication/authority semantics.

Validation: all19 held-acquisition and metadata lifecycle cases pass in this composition; core plus four owning test type projects, scoped lint/formatting, both cycle guards and fresh managed P2 review pass. Supplier real SIGTERM and import-fault proof retains its original source binding. The earlier native-tour cleanup timeout remains unattributed and was not rerun or relabeled; installed-upgrade proof and final exact-head CI remain pending.

* refactor(state): align sandbox read reply construction

Resolve the actual duplicate-extraction conflict by adopting canonical main's registry dispatcher postimage. The existing admitted constant supplies the same primitive ok/sourceAdmitted fields to each fresh reply; commands, kernel calls, arguments and admission behavior are unchanged. All11 owning native sandbox read cases, core types, lint/formatting and fresh managed P2 review pass. Prior724 hosted CI and installed-upgrade proof retain their applicable source and contract bindings; no broad main carry or dependency change.

* test(gateway): retain first sign-in timeout phases

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: joshavant <[email protected]>
steipete added a commit that referenced this pull request Sep 25, 2026
* feat(update): accept owner-bound repair turns

* fix(update): harden delegated repair authority

* fix(update): keep repair worker schema private

* test(update): retain released worker protocol coverage

* fix(update): terminate failed repair result delivery

* fix(update): exit idle repair worker on disconnect

* test(update): retain repair worker timeout diagnostics

* test(update): surface diagnostics in silent E2E runs

* test(update): capture repair worker startup logs

* fix(update): share fresh authority snapshots per repair check

Keep requester policy and update-run checks on one fresh synchronous snapshot of the original installation. Do not inherit discovery snapshots or reuse authority across callbacks. Preserve every executor, requester, IPC and run-phase check and keep source SQLite artifacts untouched.

The real Windows repair turn previously exhausted its budget while repeatedly spawning snapshot readers. Real-WAL regressions cover fresh commits, inherited-scope restoration and closed-scope refusal; preserve the existing worker deadlines and behavior.

* chore(update): trace repair authority timing

Measure cumulative executor, requester-policy, update-row and total assertion elapsed time under the existing trace log level. Record synchronous snapshot subprocess elapsed time to distinguish guard work from launch and copy costs. Preserve checks, error propagation and deadlines.

* test(gateway): complete lifecycle logger fixture

* fix(skills): filter selection before probing binaries

* fix(update): bind delegated repair to its recorded requester

Compare the IPC requester with the original update row before preparing
inference and at every fresh authority assertion. Reuse the existing managed
requester resolver and profile continuation owner so internal/operator update
routes keep their admitted authority while chat identity cannot be omitted or
substituted.

Cover the worker boundary with inert inference and real isolated ledger/config
state, including post-await origin/policy changes. Record the admitted requester
in the existing positive delegated E2E fixture.

* fix(update): integrate catalog and Gateway lifecycle repairs

Compose the reviewed metadata retirement, shared model acquisition shutdown,
and catalog provenance repairs with the repair-turn worker candidate.
Preserve first-discovery starter models and explicit no-discovery outcomes.

Sources: #157979, #158047, #158113, and 36def8b.
The historical include-only CI hook timeout remains unattributed.

Co-authored-by: Dallin Romney <[email protected]>

* fix(update): retain only required canonical integrations

Remove the imported catalog inference and marker adaptations so omitted
outcomes retain their existing contract. Keep the worker and reviewed Gateway
shutdown changes, captured provider-alias normalization, first-discovery
starter handling, and explicit HTTP-success lifecycle fixtures.

Preserve the native augmentation assertions and existing deadlines. The new
legacy-retention work in #158113 is independent of this repair-turn worker.

Co-authored-by: Dallin Romney <[email protected]>

* test(update): initialize survivor registry fixture baseline

Reuse canonical 4fa09e9 so the extracted registry-order orchestration
receives the baseline version that the real runner has already resolved.
Keep production code, ordering assertions, and timeouts unchanged.

The ten-case file, root-test types, lint, and fresh P2 review pass.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
Capture accepted runtime-hook identities before static fallback and config
merging, then carry matching registry route keys through the existing worker
result and provider inventory bindings. Preserve eligible final published
rows across repeated same-auth failures without inventing public discovery
outcomes or retaining configured-only and augmentation-only rows.

Keep provider aliases, case-distinct IDs, empty replacement, profile/source
fences and prior learned metadata over failed same-route fallback seeds.
Real-worker regressions prove both reviewed completion-map gaps and their
repair; 136 relevant cases pass across final and unchanged sibling runs.
Production and owning test compilers, selected structural/lint gates, both
cycle checks and fresh independent review pass. The inherited 721/720
local shard guard is handled by the existing canonical shard split.
Move 17 session test roots from agents-root to the existing agents-sessions
graph. This restores the 720-root boundary without increasing the limit or
changing test coverage, graph count, or compiler settings.

Verified all 12,941 current roots remain uniquely owned, the exact boundary
guard passes, and both affected canonical type graphs pass. Independent
review found no actionable issues.
@steipete
steipete marked this pull request as ready for review September 25, 2026 18:06
@clawsweeper clawsweeper Bot removed the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Sep 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The current-head review at 16012de251ec54cc2b18ebd8091f42fdaf3c8e79 reports no actionable findings and confirms the two prior provenance issues are covered by real worker-path tests. CI 36171359554 has now passed: 140 successful jobs, 19 skipped.

The remaining automated “data-model compatibility” item does not apply to this change. Both named paths are test helpers. prepared-model-catalog-legacy-fixture.ts creates synthetic credentials through the existing auth-profile store API and writes only the fixture's temporary scenario selector. prepared-model-catalog-worker-fixture.ts contains the existing synthetic SQLite catalog seed moved from its parent test-support module, with the same generated catalog structure and storage owner. Neither changes production serialization or a stored-data format.

The production additions are private, generation-bound Maps/Sets carried through the existing worker result into in-memory inventory bindings. There is no schema, migration, persisted field, or configuration-format change requiring upgrade proof. Existing source, credential, profile and lifecycle invalidation remain in force. The real-worker cases prove repeated failures, configured-only refresh, alias normalization, fallback precedence and empty-result clearing; the ordinary native/schema guards also pass. This is a source-based rejection of the test-file classification, not a waiver of migration coverage for a real storage change.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

2 participants