Skip to content

fix(beam): isolate missing mirror credentials - #128336

Closed
steipete wants to merge 4 commits into
mainfrom
steipete/secretref-beam-owner
Closed

steipete wants to merge 4 commits into
mainfrom
steipete/secretref-beam-owner

Conversation

@steipete

@steipete steipete commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Beam advertised mirror.token as SecretRef-capable but did not register or own it. The mirror resolved the credential again on every polling tick, so missing references bypassed owner isolation, exec providers could rerun repeatedly, and diagnostics could include reference details.

Why This Change Was Made

Beam declares local capability owner beam-mirror; parent PR #128318 maps it to exact runtime owner plugin-capability:beam:beam-mirror. The complete mirror configuration binds last-known-good reuse, and runtime consumes only the prepared snapshot string. Per-tick resolution and identifier-bearing warnings are removed.

This PR is stacked on #128318 and should be reviewed as the Beam-only child diff.

User Impact

An unavailable mirror token disables only outbound mirroring. Beam's authenticated receiver and session catalog remain available, while healthy unrelated capabilities continue normally. Exec/file/store/environment providers are resolved once during snapshot preparation.

AI-assisted implementation; I reviewed the diff, tests, live behavior, and security boundary.

Evidence

  • Pre-fix tests reproduced missing ownership, malformed object acceptance, per-tick resolution, reference-detail logging, and premature active announcements.
  • Environment, file, exec, and store SecretRefs materialize into the prepared snapshot; exec resolution occurs once.
  • Reload coverage proves unchanged configuration may retain stale credentials, while endpoint, token, catalogs, polling, or active-window changes make the owner cold.
  • 143 focused tests passed after rebasing onto the final parent head; broader focused validation passed before rebase.
  • Autoreview was clean before and after rebase. A dedicated security review found no qualifying new vulnerability.
  • Two isolated real dev Gateways with unique state and ports:
    • missing token: /readyz 200, exact cold plugin-capability:beam:beam-mirror, receiver/catalog still registered, no active log, zero uploads;
    • resolved synthetic token: /readyz 200, one real loopback upload with matching Bearer auth, no secret printed.

Production LOC: +77/-28 (net +49, mostly strict manifest schema; runtime TypeScript is net negative). Tests: +615/-14.

@clawsweeper

clawsweeper Bot commented Aug 23, 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 August 23, 2026 18:54
@steipete
steipete requested a review from a team as a code owner August 23, 2026 18:54
@openclaw-barnacle openclaw-barnacle Bot added plugin: beam Beam session sharing plugin size: L maintainer Maintainer-authored PR labels Aug 23, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 5:59 AM ET / 09:59 UTC.

ClawSweeper review

What this changes

The branch moves Beam mirror credentials into a prepared Gateway secret snapshot and adds manifest metadata for a capability-owned plugin secret.

Merge readiness

⚠️ Ready for maintainer review - 6 items remain

Keep open: the two prior P1 blockers remain—existing token objects need a migration, and the branch lacks current main’s in-flight upload cancellation after its stacked parent was squash-merged.

Priority: P1
Reviewed head: aeb02873a2a732bb343cf53e549c96cbc4dad195
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The intended repair is substantive, but two P1 regressions remain unresolved on the stale stacked branch.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; exact-head redacted Gateway evidence remains needed after rebase for merge confidence.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; exact-head redacted Gateway evidence remains needed after rebase for merge confidence.
Evidence reviewed 5 items Missing shutdown cancellation on the branch: The branch service only clears its interval and returns void; it retains no runner or abort handle for an upload already in progress.
Current main preserves cancellation: Current main’s mirror runner owns an AbortController, passes its signal to guarded fetch, and the service awaits runner.stop() after clearing its interval.
Schema tightens existing persisted input: Current main accepts a string or any object for mirror.token; the branch replaces that object allowance with a closed SecretRef schema.
Findings 2 actionable findings [P1] Migrate formerly accepted mirror token objects
[P1] Preserve in-flight upload cancellation
Security None None.

How this fits together

Beam has a local receiver/catalog plus an optional periodic mirror that uploads selected session data. The Gateway resolves plugin SecretRefs before runtime startup, then the mirror consumes the prepared value or stays unavailable.

flowchart LR
  A[Beam mirror configuration] --> B[Manifest secret contract]
  B --> C[Gateway secret snapshot]
  C --> D{Credential available}
  D -->|yes| E[Beam mirror upload]
  D -->|no| F[Cold mirror capability]
  F --> G[Receiver and catalog remain available]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt capability-owned plugin SecretRef metadata as the public contract for Beam’s mirror credential? Approve the capability owner contract: Keep the generic manifest contract, but land it only with the rebase, migration, and exact-head lifecycle proof.

Why: This PR extends plugin manifest ownership semantics beyond the route-only current-main contract, so the intended reusable secret-isolation boundary needs maintainer direction.

Before merge

  • Migrate formerly accepted mirror token objects (P1) - The old schema accepts any object for mirror.token, but this closed SecretRef schema rejects those persisted values during config loading. Add a Beam-owned Doctor migration or an explicit compatible conversion path, with a regression case for a formerly accepted object.
  • Preserve in-flight upload cancellation (P1) - Current main aborts and joins an active guarded upload during service shutdown; this branch only clears the polling interval. Preserve that lifecycle when rebasing so a stopped mirror cannot continue a bearer-authenticated request until timeout.
  • Resolve merge risk (P1) - The branch must be rebased after its squash-merged parent; the current dirty merge state cannot prove the final combined behavior.
  • Resolve merge risk (P1) - The capability/provider owner fields create a reusable plugin-manifest contract and need explicit maintainer acceptance before becoming the long-term security boundary.
  • Complete next step (P2) - A maintainer must choose the public secret-owner contract, then the branch needs a conflict-aware rebase and focused repair.

Findings

  • [P1] Migrate formerly accepted mirror token objects — extensions/beam/openclaw.plugin.json:98
  • [P1] Preserve in-flight upload cancellation — extensions/beam/src/mirror.ts:493-509
Agent review details

Security

None.

PR surface

Source +139, Tests +2420, Docs +22, Other 0. Total +2581 across 31 files.

View PR surface stats
Area Files Added Removed Net
Source 12 240 101 +139
Tests 17 2500 80 +2420
Docs 1 27 5 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 31 2768 187 +2581

Review metrics

Metric Value Why it matters
Production versus test delta author-reported child scope: production +77/-28; tests +615/-14 The positive production delta introduces a reusable manifest ownership contract, so migration and maintainer approval matter before merge.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-gateway-health.test.ts, migration/backfill/repair: src/commands/doctor-lint.test.ts, serialized state: extensions/beam/src/mirror.test.ts, serialized state: src/config/env-substitution.ts, serialized state: src/gateway/server-startup-plugin-secret-owner-isolation.test.ts, serialized state: src/plugins/config-contract-matches.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Rebase with compatibility and lifecycle repair (recommended)
    Retain main’s abortable mirror runner, migrate legacy token objects through Beam’s Doctor surface, and rerun exact-head proof.
  2. Pause the public owner contract
    Do not merge the new capability/provider manifest semantics until maintainers choose the supported plugin security boundary.

Technical review

Best possible solution:

Rebase the Beam-only repair onto current main, preserve the abortable mirror lifecycle, and add a Beam-owned Doctor migration for obsolete token objects before approving the new manifest contract.

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

Yes, from source: configured plugin entries are schema-validated during config reads, while the branch rejects object tokens that current main accepts; this read-only review did not execute the case.

Is this the best way to solve the issue?

No: preparing the credential once is the right direction, but the rebase must retain current main’s abortable upload lifecycle and migrate existing token objects.

Full review comments:

  • [P1] Migrate formerly accepted mirror token objects — extensions/beam/openclaw.plugin.json:98
    The old schema accepts any object for mirror.token, but this closed SecretRef schema rejects those persisted values during config loading. Add a Beam-owned Doctor migration or an explicit compatible conversion path, with a regression case for a formerly accepted object.
    Confidence: 0.96
  • [P1] Preserve in-flight upload cancellation — extensions/beam/src/mirror.ts:493-509
    Current main aborts and joins an active guarded upload during service shutdown; this branch only clears the polling interval. Preserve that lifecycle when rebasing so a stopped mirror cannot continue a bearer-authenticated request until timeout.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The branch affects active outbound mirroring and currently loses shutdown behavior that main protects.
  • merge-risk: 🚨 compatibility: The strict token schema can reject persisted object values accepted by current main.
  • merge-risk: 🚨 security-boundary: The PR defines which plugin-owned credential boundary is isolated and when it is unavailable.
  • merge-risk: 🚨 availability: Without the current abortable lifecycle, a stopped mirror can retain an in-flight upload until timeout.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; exact-head redacted Gateway evidence remains needed after rebase for merge confidence.

Evidence

What I checked:

  • Missing shutdown cancellation on the branch: The branch service only clears its interval and returns void; it retains no runner or abort handle for an upload already in progress. (extensions/beam/src/mirror.ts:493, aeb02873a2a7)
  • Current main preserves cancellation: Current main’s mirror runner owns an AbortController, passes its signal to guarded fetch, and the service awaits runner.stop() after clearing its interval. (extensions/beam/src/mirror.ts:281, 2d6e0a23af19)
  • Schema tightens existing persisted input: Current main accepts a string or any object for mirror.token; the branch replaces that object allowance with a closed SecretRef schema. (extensions/beam/openclaw.plugin.json:42, aeb02873a2a7)
  • Configured plugin schemas block invalid snapshots: Any configured plugin entry is schema-validated while the config snapshot is read, so formerly accepted non-SecretRef objects fail before runtime isolation can help. (src/config/validation-plugin-config.ts:389, aeb02873a2a7)
  • Current lifecycle provenance: Blame attributes main’s abortable service lifecycle to the current Beam implementation commit, which the branch must retain during rebase. (extensions/beam/src/mirror.ts:551, 81fb7e69c4bb)

Likely related people:

  • steipete: Current-main blame for the cancellation lifecycle and the PR/merged-parent history both point to this contributor. (role: recent Beam and secret-runtime contributor; confidence: high; commits: 81fb7e69c4bb, aeb02873a2a7, 22e892a4eaa0; files: extensions/beam/src/mirror.ts, extensions/beam/openclaw.plugin.json, src/secrets/runtime-config-collectors-plugins.ts)

Rank-up moves

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

  • Rebase onto current main and retain the abortable runner plus its stalled-upload regression coverage.
  • Add and prove a Beam Doctor migration for object tokens accepted by the released schema.
  • Record maintainer approval for the new public manifest owner contract.

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 (3 earlier review cycles)
  • reviewed 2026-08-23T19:00:57.915Z sha 2dd5b26 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T21:36:28.819Z sha fbc83ce :: found issues before merge. :: [P1] Provide an upgrade path for formerly accepted token objects
  • reviewed 2026-08-24T01:24:00.630Z sha aeb0287 :: needs changes before merge. :: [P1] Migrate formerly accepted mirror token objects | [P1] Retain cancellation of in-flight mirror uploads

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. 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 Aug 23, 2026
@steipete
steipete force-pushed the steipete/secretref-beam-owner branch from fbc83ce to aeb0287 Compare August 24, 2026 01:12
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. and removed P2 Normal backlog priority with limited blast radius. labels Aug 24, 2026
@steipete
steipete force-pushed the steipete/secretref-manifest-owner-contract branch from d412490 to dcc3950 Compare August 25, 2026 22:14
Base automatically changed from steipete/secretref-manifest-owner-contract to main August 26, 2026 09:52
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations labels Aug 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Beam credential isolation and snapshot consumption landed in #176510 (bb8183d). The current mirror pauses on unavailable credentials without resolving them on every poll, so this older stacked implementation is superseded.

Closed in a sweep of stale maintainer PRs (no activity for 7+ days). Reopen with a current reproduction if this still matters.

@steipete steipete closed this Oct 21, 2026
@RomneyDa
RomneyDa deleted the steipete/secretref-beam-owner branch October 22, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. plugin: beam Beam session sharing plugin rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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