Skip to content

fix: keep environment inventory responsive during pairing cleanup - #148988

Merged
steipete merged 17 commits into
mainfrom
codex/pond-inventory-snapshot-20260914
Sep 16, 2026
Merged

steipete merged 17 commits into
mainfrom
codex/pond-inventory-snapshot-20260914

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes device inventory waiting behind a pairing update even when committed pairing data is available.

User Impact

Inventory can return committed node state while a pairing update awaits cleanup, then show updated state after the update commits. Existing node ownership and command authorization filtering remain intact.

Why This Change Was Made

Read device pairing once and derive node pairing with the existing canonical projector. Both inventory views use one committed snapshot, removing the duplicate store read and pairing-lock wait. The real-store regression remains registered in the isolated Gateway-methods project, with its independent expected-list fixture aligned.

Evidence

  • The real-store regression fails on the original handler while a pairing writer holds cleanup open. The earlier 241-case inventory/routing/ordered-status campaign remains bound to unchanged source.
  • Canonical fixture adoption passed 29 affected cases with controlled clocks, selected checks, and scoped P2 review. Earlier 139-case and 5-case native proofs retain their separate source/run identities.
  • All eight original inventory/routing postimages remain unchanged. The prospective merge consumes current main's canonical alias fixture byte-for-byte, with one setup before the Node recorder. The prerequisite-before-recorder contract has separate macOS Node 24.21 proof: 12 failures changed to 12 passes, covering nine argument/exit-code handoffs and three trust refusals. Current CI passes on the latest merged fixture. Fresh scoped P2 review found no actionable issue.

The original-base benchmark is synthetic warm local environments.list evidence: 1,000 nodes, 50 samples per version. Median latency fell from 11.622 ms to 8.083 ms and SQLite calls from 8 to 4 per request; observed maximum increased from 15.789 ms to 23.613 ms. It does not establish tail-latency, fleet, or provider speed improvements. Live candidate comparison remains pending.

Published head b53d2dcc1b29e0bf1e14d8a4adfe1fd50184ae12 has current CI 35046642476 completed successfully. The separate proof sets are not a fresh aggregate suite. The earlier benchmark does not establish live fleet performance.

@clawsweeper

clawsweeper Bot commented Sep 15, 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 gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 09:59
@steipete
steipete requested a review from a team as a code owner September 15, 2026 09:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 10:51 PM ET / September 16, 2026, 02:51 UTC (Revision 12).

ClawSweeper review

What this changes

The PR builds environment inventory from one committed pairing snapshot, adds a blocked-writer regression, and updates Gateway, Codex, and PR-tooling test fixtures.

Merge readiness

✅ Ready for maintainer review

The fix remains useful: current main still waits on the second, lock-taking pairing read. No actionable introduced defect remains, and the prior fixture findings should not be re-raised.

Priority: P2
Reviewed head: b53d2dcc1b29e0bf1e14d8a4adfe1fd50184ae12

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused production repair with meaningful regression coverage, successful pinned-head CI, and no remaining actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its real-store handler regression supports cleanup responsiveness; the reported warm synthetic benchmark does not establish live fleet or tail-latency improvements.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its real-store handler regression supports cleanup responsiveness; the reported warm synthetic benchmark does not establish live fleet or tail-latency improvements.
Evidence reviewed 9 items Current main still contains the blocking read: Fetched main still calls listDevicePairing and listNodePairing together. The latter enters the shared pairing lock, so the central repair is not already present on main. Release inclusion was not established.
Existing projection and storage contracts: listNodePairing wraps the existing projectNodePairing in withPairedDeviceRecords. listDevicePairing already reads committed storage without that lock; the store clones cached snapshots. Reusing its paired records removes the wait without adding another storage owner or changing persisted formats.
Regression covers the intended ordering: The new test holds a real pairing-store writer open, calls the registered environments.list handler, checks the committed node before releasing the writer, then verifies the updated label after commit. It is registered in the isolated Gateway-methods project. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

The Gateway combines paired-device records, connected nodes, and worker records into environment inventory. Clients and automatic session placement consume that inventory to discover available hosts and their capabilities.

flowchart TD
  A[Committed device records] --> B[Single pairing snapshot]
  B --> C[Existing node projector]
  B --> D[Connection and ownership filtering]
  C --> D
  E[Connected nodes and workers] --> D
  D --> F[Environment inventory]
  F --> G[Clients and session placement]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1, Tests +86. Total +87 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 12 242 156 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 245 158 +87

Review metrics

None.

Technical review

Best possible solution:

Use the existing canonical projector over one committed snapshot while preserving live connection filtering and mutation-time authorization.

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

Yes, from source: hold withPairedDeviceRecords open and request environment inventory; current main's second read waits on the same lock. This review did not execute the regression.

Is this the best way to solve the issue?

Yes. Reusing the existing node projector removes the redundant serialized read without introducing a cache, new API, or competing pairing implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Gateway responsiveness repair for inventory requests blocked behind pairing cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its real-store handler regression supports cleanup responsiveness; the reported warm synthetic benchmark does not establish live fleet or tail-latency improvements.

Evidence

What I checked:

  • Current main still contains the blocking read: Fetched main still calls listDevicePairing and listNodePairing together. The latter enters the shared pairing lock, so the central repair is not already present on main. Release inclusion was not established. (src/gateway/server-methods/environments.ts:176, a76f27589c03)
  • Existing projection and storage contracts: listNodePairing wraps the existing projectNodePairing in withPairedDeviceRecords. listDevicePairing already reads committed storage without that lock; the store clones cached snapshots. Reusing its paired records removes the wait without adding another storage owner or changing persisted formats. (src/infra/device-pairing-node.ts:338, b53d2dcc1b29)
  • Regression covers the intended ordering: The new test holds a real pairing-store writer open, calls the registered environments.list handler, checks the committed node before releasing the writer, then verifies the updated label after commit. It is registered in the isolated Gateway-methods project. Tests were inspected, not executed during this read-only review. (src/gateway/server-methods/environments.pairing-snapshot.test.ts:26, b53d2dcc1b29)
  • Authority and compatibility boundaries remain intact: The handler retains managed-worker exclusion, authenticated pairing-binding filtering, live command policy, and existing response construction. The change does not modify invocation authorization, configuration, schemas, or plugin APIs. Existing tests retain ownership and command-policy cases. (src/gateway/server-methods/environments.ts:181, b53d2dcc1b29)
  • Prior finding continuity and pinned validation: GitHub confirms the final commit removes the branch-local dependency-helper call from the previously reviewed parent. The pinned introduction delta contains no remaining pr-wrappers.test.ts change. The supplied latest completed review has no findings; GitHub independently reports CI run 35046642476 succeeded on this exact head. The supplied test merge is stale, so no claim is made about its result against fetched main. (test/scripts/pr-wrappers.test.ts:1172, b53d2dcc1b29)
  • Affirmative Codex dependency signal: The changed model-attribution test exercises the registered Codex harness and supplies turn/interrupt and thread/backgroundTerminals/list protocol responses. This makes direct Codex contract inspection applicable to that test, independently of the Gateway inventory repair. (extensions/codex/src/app-server/run-attempt.model-attribution.test.ts:162, b53d2dcc1b29)

Likely related people:

  • steipete: 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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-15T13:58:22.377Z sha 1628c92 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T19:02:44.694Z sha 5c840bc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T19:22:03.041Z sha 5c840bc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T23:02:49.385Z sha 32e185c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T01:11:30.017Z sha 2c932d0 :: blocked before merge. :: [P2] Provide the dependency helper before calling it
  • reviewed 2026-09-16T01:41:44.732Z sha 2c932d0 :: blocked before merge. :: [P2] Remove the duplicate alias dependency initialization
  • reviewed 2026-09-16T02:14:06.899Z sha b53d2dc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T02:26:41.848Z sha b53d2dc :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 15, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Sep 15, 2026
Adopt the complete fixture from #149349 and #149261 so merging the inventory branch retains one terminal-list response. Preserve the controlled completion/timeout cases and the original runtime budget.
Keep alias delegation cases on their intended supervisor boundary after code-only linked checkouts gained dependency materialization. Preserve exact arguments, exit status, and trust refusals; retain separate materializer coverage.
@clawsweeper clawsweeper Bot added the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Sep 16, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
Canonical main already owns linked dependency setup before checkout. Remove the branch-local later setup so the merged fixture matches #149477 exactly, without changing the inventory or lifecycle implementation.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@steipete
steipete merged commit 8cdfed5 into main Sep 16, 2026
207 checks passed
@steipete
steipete deleted the codex/pond-inventory-snapshot-20260914 branch September 16, 2026 03:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…enclaw#148988)

* fix: keep environment inventory responsive during pairing cleanup

* test: include pairing snapshot in isolated gateway expectations

* fix: let profiler help drain pending cleanup

* test: preserve process events in runtime identity fixtures

* test: avoid loading QA runtime in receipt producers

* fix: repair native PR repository identity fixtures (openclaw#149294)

(cherry picked from commit 3df0afa)

* fix: keep Codex model attribution fixture focused (openclaw#149301)

(cherry picked from commit f778132)

* test: align canonical model attribution fixture

Adopt the complete fixture from openclaw#149349 and openclaw#149261 so merging the inventory branch retains one terminal-list response. Preserve the controlled completion/timeout cases and the original runtime budget.

* test: provide dependencies for PR alias fixtures

Keep alias delegation cases on their intended supervisor boundary after code-only linked checkouts gained dependency materialization. Preserve exact arguments, exit status, and trust refusals; retain separate materializer coverage.

* test: retire superseded PR alias fixture setup

Canonical main already owns linked dependency setup before checkout. Remove the branch-local later setup so the merged fixture matches openclaw#149477 exactly, without changing the inventory or lifecycle implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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