Skip to content

feat(portals): allow scoped previews from dedicated session attachments - #156373

Merged
vincentkoc merged 4 commits into
mainfrom
feat/session-worker-preview-20260923
Sep 23, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
feat/session-worker-preview-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Related: #156328

What Problem This Solves

Collaborators need interactive previews from dedicated workers attached to their conversations without receiving global host-port access.

User Impact

Adds a restricted portal tool and session-scoped open/list/close RPCs for dedicated secondary worker attachments. They use existing session-write ownership and sharing rules plus effective portal tool policy.

Existing owner/global portals, primary worker placements, mandatory sandbox isolation, HTTP tool restrictions, and Team/Guest role defaults retain their policies. No configuration or database migration is required.

Preview URLs remain shareable bearer links. Revoking the initiating actor prevents new operations; it does not invalidate a copied URL. Scoped resources end with their session incarnation, attachment, dedicated lease qualification, or Gateway lifetime.

Why This Change Was Made

Uses the shared session-resource admission and lifetime handling landed in #156371. This PR now targets main; its final restack is based on the landed dependency commit 05996479d8184c8c8e802448a7ef774590e30a9b.

Node portal transport reaches machine-wide loopback, so this route requires explicit provider attestation that the exact current lease is dedicated. The Crabbox plugin supplies that fact during inspection. Legacy omission behavior remains unchanged outside this capability.

A successful inspection that withdraws dedicated qualification retires it before asynchronous persistence. Failed inspections preserve the last same-owner proof. New explicit proof publishes only after authoritative reconciliation.

The existing node carrier owns discovery, final dispatch authorization, connection activity refresh, and failed-stream cleanup. Scoped and global routes share that transport after their respective admission checks. The connection retains the resource authority, not the initiating request or actor. Tool builders use one availability factory; unused constructor exports and duplicate target checks are removed.

Scoped previews have distinct resource identities. They cannot adopt an existing global portal's lifetime or credentials. Repeated opens by the same scoped owner reuse its resource; session reset or lost qualification leaves unrelated global portals intact.

Limitations:

  • Only secondary conversation attachments qualify. Primary worker-placement permissions are unchanged.
  • Sessions with modelSelectionLocked: true remain excluded. Canonical RPC admission and revalidation enforce this; tool visibility is not the security boundary.
  • Node connectivity and portal-stream support are checked on open/connect. Follow-up: prepared node-capability availability during tool construction.
  • Follow-up: prepared ownership support for model-locked/native-imported sessions.
  • DNS, Cloudflare Access, and remote-browser reachability configuration are outside this change.

Evidence

Coverage includes explicit/omitted/shared lease classification, restart and revocation, startup cancellation, session reset before asynchronous cleanup, active-stream retirement, bearer-link lifetime, scoped credential filtering, both tool builders, and unchanged owner/global behavior.

Original-order regressions create a global worker portal before a scoped preview on the same port, then verify distinct links, scoped reuse, and independent cleanup. Real-router regressions reject locked canonical sessions under both broad and own-session write scopes.

The owner-integration test covers the real router, descriptors, tool-policy admission, worker store/service, attachment, and carrier, including persisted activity updates and original-order revocation races.

The authenticated transport test uses real signed operator/node connections, device and node capability approvals, the Gateway-owned provider registry/store/service, and actual bearer HTTP through the ticket WebSocket and node TCP stream. It proves allowed traffic, an unrelated writer producing no node or destination I/O, and existing-stream closure plus no new node dispatch before either delayed or rejected qualification persistence completes. The provider is deterministic and the enrolled node is emulated using the real stream-command handler; this is not a Team-server deployment or a full node process.

The test queries the actual Gateway-owned bundle producer. This run observed missing worker artifacts (ENOENT) and verified the existing historical admitted-lease preservation path; when a build is present it uses that exact build receipt.

Independent scoped review found no actionable P0–P2 findings. No Team-server deployment or configuration change is included.

Production LOC: +749/-94 (net +655); generated protocol: +89; tests/support: +1633/-140 (net +1493); docs: +40/-2. The 44-file diff adds the scoped capability and explicit lease/session/resource ownership boundaries. Transport consolidation removes duplicate lifecycle handling; test growth covers the original ordering races. Generated Swift/Kotlin additions do not change the protocol version.

Broader Browser + Portal feature qualification passed on a remote Linux Testbox:

  • 225 focused runtime tests, including the real Portal router/service/carrier assembly, global/scoped handlers, model tools, worker lifecycle, and Browser Chromium fixtures.
  • pnpm tsgo:core; Browser package production graph; pnpm tsgo:test:root; affected agents-root/tools and gateway-root/methods/other test graphs; pnpm tsgo:extensions:test.
  • Targeted formatting and type-aware lint; static and runtime-value cycle gates; all Knip scans; Browser catalog validation.
  • Exact source hashes matched the validated overlay. The original Portal-only patch remained byte-identical when restacked onto the published Browser dependency. The final main-targeted restack preserves the same feature behavior, with mechanical catalog ordering and tool-import adaptations; the authenticated transport fixture remains byte-identical.

Current changed-surface proof: 34 method-list tests, 8 Crabbox plugin tests, and the authenticated Portal transport test passed; the latter completed in 8.216 seconds. Targeted formatting and lint passed with no warnings; core production, root test, Gateway-root and Gateway-server test compiler graphs passed.

The additive protocol/SDK surfaces, generated client freshness, line-cap ratchet, documentation inventory, and combined build passed during the feature qualification. Hosted CI remains the exact-head landing gate.

Final main-targeted restack proof at b538a63d99fac2234cbede01834f3ca910e771b2: 88 focused tests passed across method ordering, both Portal tool builders, scoped handler/policy, and worker lifecycle. Canonical protocol registry/generation/Swift/Kotlin freshness and since guards, targeted formatting, core production types, and agents-root/Gateway-root/Gateway-methods test compiler graphs passed on the exact verified Testbox source. Independent review confirmed the four mechanical conflict resolutions preserve landed main and Portal behavior.

@vincentkoc vincentkoc self-assigned this Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling extensions: crabbox size: XL labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 23, 2026, 12:13 PM ET / 16:13 UTC (Revision 5).

ClawSweeper review

What this changes

Adds tools and Gateway requests that let conversation writers open previews on dedicated attached workers, alongside the stacked Browser dashboard changes.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains useful work: current main lacks scoped worker previews, and the prior Portal findings are resolved. The merged Browser dependency does not supersede this capability. No new actionable Portal defect was found; the branch currently conflicts with main.

Priority: P2
Reviewed head: a18534410da1aa8a05ebb5d6fc3c649d5486f645

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with meaningful authenticated boundary proof and resolved prior findings; merge conflicts remain a separate workflow blocker.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The reported Linux Testbox execution matches the inspected production-path fixture: signed Gateway clients and real HTTP/WebSocket/TCP traffic prove allowed delivery, unrelated-writer rejection before I/O, and revocation before delayed or rejected persistence. The deterministic provider and emulated node are disclosed; no stored-data format changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The reported Linux Testbox execution matches the inspected production-path fixture: signed Gateway clients and real HTTP/WebSocket/TCP traffic prove allowed delivery, unrelated-writer rejection before I/O, and revocation before delayed or rejected persistence. The deterministic provider and emulated node are disclosed; no stored-data format changes require migration.
Evidence reviewed 10 items Pinned change ownership: Reviewed the merge-base-to-head introduction delta. It contains the stacked Browser implementation plus the Portal commits; main-to-head differences were not treated as PR-introduced removals.
Dependency landed; conflicts remain: GitHub confirms #156371 merged at 0599647. A separate current REST read confirms this PR still targets main at the reviewed head and reports mergeable=false, mergeable_state=dirty. The previous request to land the dependency and retarget is complete; conflict composition remains.
Still absent from current main: The current main method table exposes only global portal.list/open/close, and its Portal handler has no session-scoped route. The merged Browser work therefore does not implement the remaining worker-preview capability.
Findings None None.
Security None None.

How this fits together

Gateway Portals turn application ports into authenticated preview links. The new route checks conversation access and dedicated worker ownership before forwarding browser traffic through the existing node transport.

flowchart LR
  A[Conversation writer] --> B[Session and tool permission checks]
  B --> C[Dedicated worker attachment]
  C --> D[Bearer preview link]
  D --> E[Authenticated node transport]
  E --> F[Worker application]
  G[Session and lease lifetime] --> D
Loading

Before merge

  • Complete next step (P2) - Resolve the conflicts against main while preserving the landed Browser authorization fixes, then review and validate the resulting Portal delta.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Scoped Portal API 3 additive RPCs; no new configuration option Open, list, and close share existing session-write admission and tool policy.
Portal-only implementation growth Production +655 net; tests/support +1493 net; generated protocol +89 The separately inspected Portal commit range attributes growth to scoped admission, resource ownership, and ordered transport regressions rather than the already-landed Browser stack.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #156328
Summary: This PR implements the dedicated-worker preview portion of the shared feature request; the Browser portion has landed separately.

Members:

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

Technical review

Best possible solution:

Compose the scoped Portal capability with main’s landed session-resource authority, retaining separate global resources and the verified lease-retirement behavior.

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

Not applicable as a bug reproduction: this adds a capability absent from main. The supplied authenticated fixture exercises the new allowed, denied, and revoked transport paths.

Is this the best way to solve the issue?

Yes for the Portal design: it extends existing session admission and node transport without another preview service. The conflicted composition with current main still needs review.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded collaboration capability for dedicated worker previews, with no established urgent production regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The reported Linux Testbox execution matches the inspected production-path fixture: signed Gateway clients and real HTTP/WebSocket/TCP traffic prove allowed delivery, unrelated-writer rejection before I/O, and revocation before delayed or rejected persistence. The deterministic provider and emulated node are disclosed; no stored-data format changes require migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported Linux Testbox execution matches the inspected production-path fixture: signed Gateway clients and real HTTP/WebSocket/TCP traffic prove allowed delivery, unrelated-writer rejection before I/O, and revocation before delayed or rejected persistence. The deterministic provider and emulated node are disclosed; no stored-data format changes require migration.

Evidence

What I checked:

  • Pinned change ownership: Reviewed the merge-base-to-head introduction delta. It contains the stacked Browser implementation plus the Portal commits; main-to-head differences were not treated as PR-introduced removals. (a18534410da1)
  • Dependency landed; conflicts remain: GitHub confirms feat(browser): allow isolated dashboards for session writers #156371 merged at 0599647. A separate current REST read confirms this PR still targets main at the reviewed head and reports mergeable=false, mergeable_state=dirty. The previous request to land the dependency and retarget is complete; conflict composition remains. (05996479d818)
  • Still absent from current main: The current main method table exposes only global portal.list/open/close, and its Portal handler has no session-scoped route. The merged Browser work therefore does not implement the remaining worker-preview capability. (src/gateway/methods/core-descriptors.ts:547, 8853510cfd32)
  • Latest release comparison: The v2026.9.5 method table likewise contains only the three global Portal methods; no scoped Portal implementation was established in that release. (src/gateway/methods/core-descriptors.ts:550, ec9c1a13db89)
  • Prior qualification finding resolved: Successful inspection that withdraws explicit dedicated qualification now aborts its resource authority before asynchronous reconciliation. Failed inspections preserve the previous same-owner qualification. Ordered tests cover both delayed and rejected persistence. (src/gateway/worker-environments/dedicated-node-lease-attestations.ts:114, a18534410da1)
  • Prior activity finding resolved: The shared carrier checks resource authority during discovery and final dispatch, refreshes attachment activity after stream attachment, rechecks authority, and tears down failed streams. Both global and scoped handlers use this owner. (src/gateway/worker-environments/portal-node-carrier.ts:135, a18534410da1)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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 (4 earlier review cycles)
  • reviewed 2026-09-23T09:54:59.683Z sha f602733 :: needs real behavior proof before merge. :: [P1] Retire withdrawn dedicated qualification before awaiting persistence | [P2] Refresh attachment activity when scoped previews connect
  • reviewed 2026-09-23T10:19:45.961Z sha e0168dc :: needs real behavior proof before merge. :: [P1] Retire withdrawn dedicated qualification before awaiting persistence | [P2] Refresh attachment activity when scoped previews connect
  • reviewed 2026-09-23T11:15:20.727Z sha 7784419 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T13:11:03.451Z sha a185344 :: needs changes before merge. :: none

@vincentkoc
vincentkoc force-pushed the feat/session-worker-preview-20260923 branch from f602733 to e0168dc Compare September 23, 2026 10:11
@vincentkoc
vincentkoc marked this pull request as ready for review September 23, 2026 10:11
@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Sep 23, 2026
@vincentkoc
vincentkoc force-pushed the feat/session-worker-preview-20260923 branch from e0168dc to 7784419 Compare September 23, 2026 11:07
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 23, 2026
@vincentkoc
vincentkoc force-pushed the feat/session-browser-access-20260923 branch from bbb6bb3 to 5a10103 Compare September 23, 2026 12:54
@vincentkoc
vincentkoc force-pushed the feat/session-worker-preview-20260923 branch from 7784419 to a185344 Compare September 23, 2026 13:03
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@vincentkoc
vincentkoc force-pushed the feat/session-browser-access-20260923 branch from 5a10103 to 104cc0e Compare September 23, 2026 13:13
@vincentkoc
vincentkoc force-pushed the feat/session-browser-access-20260923 branch from a2274bc to 1e6ef16 Compare September 23, 2026 15:39
Base automatically changed from feat/session-browser-access-20260923 to main September 23, 2026 16:04
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: b538a63d99fac2234cbede01834f3ca910e771b2
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head b538a63d99fac2234cbede01834f3ca910e771b2. Browser dependency #156371 is merged, and this PR now targets main on its landed commit 05996479d8184c8c8e802448a7ef774590e30a9b. The restack preserves the feature and authenticated transport fixture; four mechanical resolutions retain main's catalog order and hosted-tool factory extraction. Independent resolution review is clean. Exact-head remote proof passed 88 focused tests, canonical protocol generation/freshness, targeted formatting, and affected core/agents/Gateway compiler graphs. The PR body retains the authenticated transport proof and its historical-receipt/emulated-node limits.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit c7bab50 into main Sep 23, 2026
221 of 222 checks passed
@vincentkoc
vincentkoc deleted the feat/session-worker-preview-20260923 branch September 23, 2026 17:14
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…ts (openclaw#156373)

* feat(portals): allow scoped previews from dedicated session attachments

* fix(portals): complete scoped preview admission and protocol contracts

* fix(portals): centralize carrier guards and lease retirement

* test(gateway): prove session previews over authenticated node transport

Co-authored-by: Vincent Koc <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: web-ui App: web-ui docs Improvements or additions to documentation extensions: crabbox gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL 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