Skip to content

refactor(gateway): reuse live-text receipt map allocation - #178019

Merged
steipete merged 1 commit into
mainfrom
deslop/z33-32-inner-map-owner-20261015
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z33-32-inner-map-owner-20261015

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Gateway's live-text receipt path repeats the existing object-owner inner-map allocation helper.

What changed

Use the existing getOrCreateWeakOwnerMap owner for that allocation. Receipt publication, pairing checks, current-publication checks, ordering and settlement remain in place. No new helper, SDK export, configuration, schema or protocol change remains.

This is the retained area fragment after the campaign's mandatory CI-attribution repair, not the original 139-line cleanup. The original wider cut is preserved on deslop/z33-parked-skill-snapshot-map-20261015 at a01e27ba228fb0b1f86e8e29384bf73a052348a4 without a separate PR. The initial family plus its disjoint accumulator exceeded 80 paths and was split by area; the failed-test slice is now parked rather than counted as landed savings.

Best-effort tradeoffs accepted

None in this retained slice. No guard, timeout, authorization boundary, durability behavior or recovery guarantee is removed.

Size

One production file: 2 lines added, 5 removed; 3 net production lines removed. No test changes.

Proof

All 41 focused cases across four files passed, including the 23-case Gateway consumer, the existing WeakMap owner, all three wrapper/import-closure entrypoints, and the 14-case suppression audit. Targeted native typecheck of four explicit roots, typed lint, formatting, zero runtime/static cycles, and the staged changed-check planner dry run passed. Every proof receipt matches the current production source hash. No broad local suite or whole-graph typecheck ran.

The original exact-head CI run 39367982787 failed checks-node-changed-compact-large-12 (118449540029) on src/skills/runtime/session-snapshot-content.test.ts, “ignores losing skill edits but refreshes when the precedence winner disappears,” with a worker-task timeout. Its downstream CI gate also failed. The failure report was UNKNOWN, not inherited; the coordinator flake list and the last six completed scheduled main runs did not establish a matching signature.

One serial focused pinned-Bun replay of the seven-case file passed on the original head and on the captured main baseline. That is inconclusive, not a fix or inherited-failure proof. Following the campaign rule, all 41 changed files reachable through the conservative value/dynamic-import and named-worker graph now match fresh main. The extra worker edge was traced through the shared-state read-worker registry; declaration-resolution gaps are retained as a diagnostic limitation, not claimed absent. Remaining cost-neutral Map extractions and their proposed helper were also removed during simplification. Only the independent Gateway receipt-map reuse remains. The original 12-file CI shard was not replayed locally; exact-head PR CI supplies broad proof.

Independent P0–P2 review of the pre-simplification superset completed scoped-clean; the final subtractive simplification reuses the existing helper with the identical reviewed get/allocate/set body. No new runtime algorithm was added afterward.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@steipete
steipete marked this pull request as ready for review October 20, 2026 04:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T06:12:13.482862Z 38ee757 New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: M labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: 38ee757c549479218fb1e6d3bb59290fd6db349c

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR consolidates nested Map allocation into the existing Map utility and removes replaced helpers.

Example: Two Models page requests use different provider sets for the same agent.

  • Before: Each provider set retains its own cache entry through a private allocation helper.
  • After: Each provider set retains the same separate cache entry through the shared allocation helper.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-equivalent, with useful contract coverage; evidence is test-based and the failed CI shard remains unattributed.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence describes utility and consumer tests, and the diff does not materially change authority.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible behavior change is intended; repeated internal allocation implementations increase maintenance work.
Reason: The maintainer-authored direction is established, and the diff consolidates one operation without introducing competing ownership or unrelated behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed refactor removes duplicated allocation code without changing caller behavior; no actionable code or security findings were identified.

Priority: P3
Reviewed head: a01e27ba228fb0b1f86e8e29384bf73a052348a4

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence describes focused consumer and utility tests, without a shipped-entry-point run of this refactor.
Agent review details

How this fits together

Gateway, agent, plugin, and worker owners pass their existing Map or WeakMap and owner key to a dependency-free utility, which returns the existing inner Map or allocates one.

flowchart TD
  A[Gateway and agent callers] --> C[Map allocation utility]
  B[Plugin and worker callers] --> C
  C --> D[Existing Map or WeakMap]
  D --> E[Owner scoped inner Map]
  E --> F[Caller managed entries and lifecycle]
Loading

Technical review

Best possible solution:

Retain the shared allocation operation in the existing utility while keeping keys, authorization, eviction, and cleanup with their current callers.

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

This is a behavior-preserving refactor rather than a reported runtime defect; source inspection confirms repeated allocation blocks, and no target code was executed.

Is this the best way to solve the issue?

The change uses an existing dependency-free owner, removes replaced paths, and preserves native key identity without adding state or public contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 04892ee adds src/infra/map-size.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 04892ee230e6; files: src/infra/map-size.ts)
  • Ayaan Zaidi: Raw commit c3f0b6a adds src/gateway/server-methods/models-auth-status-usage-cache.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: c3f0b6abc010; files: src/gateway/server-methods/models-auth-status-usage-cache.ts)

PR surface

Source -139, Tests +7. Total -132 across 45 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 43 107 246 -139
Tests 2 26 19 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 45 133 265 -132

Review metrics

Metric Value Why it matters
Production versus test delta Production +107/-246; tests +26/-19 The shared helper removes 139 net production lines while preserving existing contracts and adding one distinct Map-key case.

Labels

Label changes:

  • add P3: Behavior-preserving internal cleanup with no demonstrated user-facing regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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:

  • P3: Behavior-preserving internal cleanup with no demonstrated user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Identify the failing test behind the worker timeout and establish whether it is caused by this diff or an independently evidenced outside failure.

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 October 20, 2026, 12:24 AM ET / 04:24 UTC.

@steipete
steipete force-pushed the deslop/z33-32-inner-map-owner-20261015 branch from a01e27b to 38ee757 Compare October 20, 2026 06:10
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed commands Command implementations agents Agent runtime and tooling size: M labels Oct 20, 2026
@steipete steipete changed the title refactor: share nested map allocation across core owners refactor(gateway): reuse live-text receipt map allocation Oct 20, 2026
@steipete
steipete merged commit 28a0b58 into main Oct 20, 2026
120 of 124 checks passed
@steipete
steipete deleted the deslop/z33-32-inner-map-owner-20261015 branch October 20, 2026 07:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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