Skip to content

fix: keep image compression policy consistent during plugin reloads - #125182

Merged
steipete merged 2 commits into
mainfrom
steipete/optimistic-kepler-d09f5d
Aug 17, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/optimistic-kepler-d09f5d

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Related: #125090

What Problem This Solves

Fixes an issue where image preprocessing could combine compression limits from two plugin lifecycle generations when an admitted agent run overlapped a plugin metadata refresh. The run's augmentation decision stayed on its prepared generation, but static model metadata could be read from the replacement generation.

Why This Change Was Made

The complete compression-policy path now carries the caller-owned prepared model runtime. Direct static catalog resolution and hook-aware model resolution both consume that exact generation, with no new cache, fallback, compatibility path, or image-specific lifecycle owner. The original ClawSweeper P1 was addressed at the model-resolution owner: both internal static fallbacks now consume the prepared metadata snapshot, and the lifecycle regression exercises the real resolver rather than a stub.

User Impact

Image compression remains consistent with the model and plugin generation admitted for the run during reload overlap. There is no config, API, protocol, storage, or dependency change.

Evidence

  • Before the complete repair, the real-resolver lifecycle regression failed on e04402ce6095 with generation B (maxBytes: 2000000, preferredSidePx: 2560, tokenMode: provider) instead of generation A (1000000, 1280, detail).
  • Final named real-resolver lifecycle regression — 1 passed.
  • node scripts/run-vitest.mjs src/agents/tools/image-tool.test.ts — 101 passed.
  • Model resolver suite — 150 passed.
  • Static catalog suite — 28 passed.
  • Final node scripts/check-changed.mjs run — core and coreTests passed, including format, production/test type checking, lint, dead exports, guards, and import cycles.
  • Complete git diff --check passed.
  • Production LOC: +19/-20 (net -1). Tests/test support: +97/-49 (net +48).
  • Codex-backed autoreview clean.

AI-assisted: yes. The code, lifecycle ownership, and proof were reviewed and understood before publication. Agent transcript omitted by default.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 08:55
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:46 AM ET / 10:46 UTC.

ClawSweeper review

What this changes

The PR carries the admitted run’s prepared model runtime through image compression and static model-catalog fallback resolution so plugin reloads cannot mix generations.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for explicit maintainer handling: the supplied head fixes a source-proven lifecycle-generation gap, while the protected maintainer label and in-progress exact-head checks preclude an automated close or merge verdict.

Priority: P2
Reviewed head: 056cc8f4ac6ee08955a8296ae76fcac21d38e417
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The supplied patch is a focused, source-aligned repair with targeted regression evidence; exact-head checks remain the final merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal lifecycle repair is exempt from the external-contributor proof gate; the PR body nevertheless includes an after-fix resolver regression run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal lifecycle repair is exempt from the external-contributor proof gate; the PR body nevertheless includes an after-fix resolver regression run.
Evidence reviewed 6 items Current-main defect path: The static fallback first consults manifest catalog rows and then provider catalog rows without passing the prepared runtime metadata snapshot; the catalog owner documents that using a snapshot is what prevents generation mixing.
Proposed owner-boundary repair: The supplied PR diff passes the prepared metadata snapshot into both static fallbacks and updates image compression to carry the prepared runtime rather than independently selecting current metadata.
Regression coverage: The PR body reports a real-resolver lifecycle regression that failed before the final repair and passes after it, alongside focused image-tool, resolver, and static-catalog suites.
Findings None None.
Security None None.

How this fits together

Image preprocessing obtains compression limits from the selected model before media is sent to the agent tool flow. Plugin reloads replace process metadata, so an admitted run must retain its prepared metadata generation across model fallbacks.

flowchart LR
  A[Admitted agent run] --> B[Prepared model runtime]
  B --> C[Image compression policy]
  C --> D[Model resolution]
  D --> E[Static catalog fallbacks]
  E --> F[Image preprocessing]
  G[Plugin reload] --> H[Replacement metadata generation]
Loading

Decision needed

Question Recommendation
After the exact head’s required checks complete, should this maintainer-owned lifecycle fix be merged? Merge after exact-head checks: Merge once the in-progress checks pass and the lifecycle regression remains part of the exact head.

Why: The protected maintainer label requires an explicit maintainer merge decision even though the supplied patch addresses the prior blocker.

Before merge

  • Resolve merge risk (P1) - The local checkout could not fetch the exact PR head, and several exact-head checks remain in progress; merge only after that validation completes and a maintainer reviews the protected item.
Agent review details

Security

None.

PR surface

Source -2, Tests +49. Total +47 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 20 22 -2
Tests 3 96 47 +49
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 116 69 +47

Review metrics

Metric Value Why it matters
Production versus test delta production +19/-20 (net -1); tests/test support +97/-49 (net +48) The bug fix is production-net-negative while adding targeted lifecycle and resolver coverage.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/agents/tools/image-tool.test-support.ts, vector/embedding metadata: src/agents/tools/image-tool.test.ts, vector/embedding metadata: src/agents/tools/image-tool.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #125182
Summary: This PR is the remaining direct-fallback propagation repair after related static-catalog lifecycle work landed.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Finish exact-head lifecycle validation (recommended)
    Allow the in-progress checks to complete on the current head before merging a change that binds an admitted run to one metadata generation.

Technical review

Best possible solution:

Retain one caller-owned prepared runtime through every image compression resolver path, then merge only after exact-head validation confirms the lifecycle regression remains covered.

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

Yes, from source: current main’s static fallback at src/agents/embedded-agent-runner/model.ts:331 and :341 omits the prepared snapshot, and the PR supplies a pre-fix/fixed real-resolver lifecycle regression.

Is this the best way to solve the issue?

Yes, based on the supplied diff: propagating the existing prepared runtime through both catalog fallbacks fixes the owner boundary without adding an image-specific cache, fallback, or lifecycle owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded agent lifecycle consistency repair without evidence of broad runtime unavailability.
  • merge-risk: 🚨 session-state: The changed policy selects metadata for an already-admitted run while plugin lifecycle generations can change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored internal lifecycle repair is exempt from the external-contributor proof gate; the PR body nevertheless includes an after-fix resolver regression run.

Evidence

What I checked:

  • Current-main defect path: The static fallback first consults manifest catalog rows and then provider catalog rows without passing the prepared runtime metadata snapshot; the catalog owner documents that using a snapshot is what prevents generation mixing. (src/agents/embedded-agent-runner/model.ts:331, 0bc877e88918)
  • Proposed owner-boundary repair: The supplied PR diff passes the prepared metadata snapshot into both static fallbacks and updates image compression to carry the prepared runtime rather than independently selecting current metadata. (src/agents/embedded-agent-runner/model.ts:337, 056cc8f4ac6e)
  • Regression coverage: The PR body reports a real-resolver lifecycle regression that failed before the final repair and passes after it, alongside focused image-tool, resolver, and static-catalog suites. (src/agents/tools/image-tool.test.ts:3184, 056cc8f4ac6e)
  • History provenance: Blame attributes the unpinned static-fallback block to the session-move feature commit, which is the current-main source location the patch completes. (src/agents/embedded-agent-runner/model.ts:331, f59e945013db)
  • Related merged work: The provided context identifies the merged static-catalog lifecycle work as overlapping groundwork; this PR covers the remaining direct-fallback propagation gap. (src/agents/embedded-agent-runner/model.static-catalog.ts:165, f77d2ec3a80b)
  • Inspection limitation: The local promisor checkout could not hydrate the PR-head commit because github.com DNS resolution failed, so exact-head source review relies on the supplied GitHub diff and PR evidence rather than a local head checkout. (056cc8f4ac6e)

Likely related people:

  • steipete: Current fallback lines blame to a commit authored by steipete, and the related merged static-catalog lifecycle work is also attributed to this area. (role: feature owner and recent area contributor; confidence: high; commits: f59e945013db, f77d2ec3a80b; files: src/agents/embedded-agent-runner/model.ts, src/agents/embedded-agent-runner/model.static-catalog.ts, src/agents/tools/image-tool.ts)

Rank-up moves

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

  • Wait for the in-progress exact-head checks, then obtain the protected-label maintainer merge decision.

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 (1 earlier review cycle)
  • reviewed 2026-08-17T09:01:45.565Z sha e04402c :: found issues before merge. :: [P1] Pin the static fallback to the prepared metadata snapshot

@steipete

Copy link
Copy Markdown
Contributor Author

Verification for 056cc8f4ac6ee08955a8296ae76fcac21d38e417:

  • Before the complete repair, the named real-resolver A→B lifecycle regression failed on e04402ce6095 with generation B (maxBytes: 2000000, preferredSidePx: 2560, tokenMode: provider) instead of generation A (1000000, 1280, detail).
  • Final named real-resolver regression: 1 passed. Full image tool suite: 101 passed. Model resolver suite: 150 passed. Static catalog suite: 28 passed.
  • Final node scripts/check-changed.mjs run passed the core and coreTests lanes, including format, production/test type checking, lint, dead exports, guards, and import cycles. Complete git diff --check passed.
  • Production LOC: +19/-20 (net -1). Tests/test support: +97/-49 (net +48).
  • Codex-backed autoreview clean.
  • Exact-head pull-request CI: run 32021187153 completed successfully for 056cc8f4ac6ee08955a8296ae76fcac21d38e417.
  • ClawSweeper's August 17 review identified one P1 and derived merge-risk/quality rank-up moves on e04402ce6095. Commit 056cc8f4ac6e addresses every move at the model-resolution owner: both internal static fallbacks consume the prepared metadata snapshot, and the stubbed proof is replaced by the real A→B resolver regression. No move was skipped. The review is under 12 hours old, and the follow-up push is limited to the finding and mechanical proof refresh, so no redundant re-review was requested.

Live-proof classification: deterministic internal lifecycle owner boundary. There is no external API, channel, UI, config, protocol, storage, or dependency surface; the controlled real-resolver generation-swap regression is the strongest relevant proof.

@steipete
steipete merged commit bb95d10 into main Aug 17, 2026
220 checks passed
@steipete
steipete deleted the steipete/optimistic-kepler-d09f5d branch August 17, 2026 10:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…penclaw#125182)

* fix: keep image compression policy consistent during plugin reloads

* fix: pin model static fallbacks to prepared metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant