Skip to content

fix: keep model catalog refresh working after logging starts - #197736

Merged
steipete merged 1 commit into
mainfrom
fix/2430-catalog-proof
Nov 12, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/2430-catalog-proof

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: remote model-catalog refresh can stop publishing new rows after logging starts.

User Impact

Users can refresh the model catalog without a later logger initialization invalidating the catalog worker's environment. Existing admitted runs keep their original catalog and pricing. Explicit source-map diagnostic opt-ins remain supported.

Why This Change Was Made

#197586 (5358d05ca2c1dc8c8a4770704a03c1a8f89b5f78) introduced a lazy TSLOG_SOURCE_MAPS default in buildLogger(). If workers already captured the environment, this assignment causes discovery to reject with Gateway catalog environment changed without retiring its plugin generation.

Publish that existing default when logging configuration is applied, before Gateway model runtimes capture the environment. One private initializer also serves standalone logger construction. This preserves dotenv/config precedence and avoids eager logger or filesystem initialization. Catalog validation stays intact; ordinary logging still avoids synchronous source-map probes.

Production growth is five lines for the shared initializer; the existing process fixture grows six lines to verify that logger construction preserves the published environment policy. No new configuration, cache, dependency, schema, or production export.

Evidence

  • Native CI failure: bounded local traces reproduced the original 120-second publication timeout and identified TSLOG_SOURCE_MAPS as the sole changed environment key.
  • Exact parent 9d8a51429d13f27be7252850f1d9ee8f72844986: the final regression assertion fails because logger construction changes the policy from undefined to off.
  • Original catalog v1/v2 pass (28.313s / 15.050s), together with logger worker/settings/reload/browser-import tests: 16 passing cases. The real worker fixture retains zero synchronous filesystem calls during 23 settled logging batches, plus rotation, recovery, shutdown, raw callsites, and explicit diagnostic opt-in.
  • Synthetic import-then-dotenv proof preserves explicit TSLOG_SOURCE_MAPS=on through logging configuration publication. Module-level default initialization was rejected because it would suppress that later opt-in.
  • Affected Control UI usage/session-owner attribution E2E: 4/4 pass in Chromium.
  • pnpm check:changed --base 9d8a51429d13f27be7252850f1d9ee8f72844986 passed every stage except the seven unused exports introduced by refactor(decisions): share one Decision HTTP executor across providers #197615. Integrated their exact landed owner fix, fix(ci): clean up unused Decision transport exports #197679 / c06331c4b8e6f7be8ed947a43c5ab9701961fd16; the canonical dead-export replay now passes production, full-tree, and script scans with zero entries. Logging, catalog, bootstrap, UI, and dependency inputs are unchanged across that integration, and the reviewed two-file candidate is byte-identical, so focused proof is reused.
  • Independent Codex review of the final candidate: scoped-clean through P2.

@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review November 12, 2026 12:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T12:51:27.288250Z e22e72a Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review head e22e72a. The logging owner now establishes its source-map default when logging config is applied, before catalog environment capture, while preserving explicit dotenv/config opt-in. The PR evidence records the original catalog failure, focused regression proof, and completed local checks.

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR establishes the existing source-map logging default before catalog workers capture the process environment.

Example: With TSLOG_SOURCE_MAPS unset, a Gateway refresh publishes the remote-next catalog row after logging starts.

  • Before: Lazy logger construction changes the environment to TSLOG_SOURCE_MAPS=off, causing catalog worker reuse to reject.
  • After: Logging configuration establishes off before environment capture, so later logger construction preserves the captured environment.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-correct; supplied validation supports harness confidence but does not satisfy the required real-behavior proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Refreshing the model catalog can stop publishing new models after logging initializes.
Reason: The maintainer-authored direction repairs an unintended startup-order interaction without adding configuration or changing the documented diagnostic policy.

Regression provenance

Regression provenance — verified: source commit 5358d05ca2c1 by Peter Steinberger; canonical PR #197586 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a catalog refresh regression still present on main, with no actionable code findings.

Priority: P2
Reviewed head: e22e72a4d281cf4795191c1797b9dacfb15b8985

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted terminal output or logs from a running Gateway showing a new catalog row publishing after logging initializes, with the explicit diagnostic opt-in preserved.
Agent review details

How this fits together

Gateway startup publishes logging configuration before preparing model runtimes; catalog workers fingerprint their environment and reject incompatible reuse.

flowchart TD
  A[Gateway startup] --> B[Apply logging configuration]
  B --> C[Initialize source map policy]
  C --> D[Capture catalog environment]
  D --> E[Catalog worker]
  C --> F[Later logger construction]
  F --> G[Unchanged environment]
  G --> E
Loading

Technical review

Best possible solution:

Establish the existing default through the logging owner before environment capture, retaining standalone initialization and explicit opt-ins.

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

Source establishes the failure path: capture an environment without TSLOG_SOURCE_MAPS, initialize logging, then reuse the catalog pool with current borrowers; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete repair using existing owners: publish the default earlier instead of weakening catalog validation, rebuilding workers, or eagerly constructing a logger.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Source-map policy initialization keeps the original intent (5358d05: Avoid synchronous source-map filesystem probes while retaining raw callsites and explicit diagnostic opt-in.)
  • Logging configuration publication keeps the original intent (2456c77: Publish lifecycle-owned logging settings rather than repeatedly rediscovering configuration on hot paths.)
  • Existing file transport process fixture keeps the original intent (5358d05: Exercise actual logger I/O, rotation, recovery, shutdown, and diagnostic opt-in outside the test runner process.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2456c77 adds src/logging/logger.ts:94 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2456c7745991; files: src/logging/logger.ts)
  • Vincent Koc: Raw commit 20e79ae adds src/logging/logger.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 20e79ae11d35; files: src/logging/logger.ts)

PR surface

Source +5, Tests +6. Total +11 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 7 2 +5
Tests 1 8 2 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 4 +11

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +5; tests +6 Growth is justified by a reused initializer and an assertion added to the existing process fixture.

Labels

Label changes:

  • add P2: Repairs a specific current-main catalog publication regression; the available evidence does not establish a released, widespread outage.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: Repairs a specific current-main catalog publication regression; the available evidence does not establish a released, widespread outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 November 12, 2026, 7:56 AM ET / 12:56 UTC.

@steipete
steipete merged commit 7910cd6 into main Nov 12, 2026
219 of 220 checks passed
@steipete
steipete deleted the fix/2430-catalog-proof branch November 12, 2026 13:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Nov 12, 2026
Preserve the exact #197736 prerequisite ancestry and its stable logging policy publication before catalog environment capture. Both remote catalog schema cases pass on the combined pricing tree. Pricing owner, benchmark, and dependency inputs remain unchanged; no default log-target changes are included.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS 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