Repository navigation
feat(portals): allow scoped previews from dedicated session attachments - #156373
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 23, 2026, 12:13 PM ET / 16:13 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherGateway 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
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
f602733 to
e0168dc
Compare
e0168dc to
7784419
Compare
bbb6bb3 to
5a10103
Compare
7784419 to
a185344
Compare
5a10103 to
104cc0e
Compare
a2274bc to
1e6ef16
Compare
|
a185344 to
b538a63
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…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]>
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
portaltool and session-scoped open/list/close RPCs for dedicated secondary worker attachments. They use existing session-write ownership and sharing rules plus effectiveportaltool 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 commit05996479d8184c8c8e802448a7ef774590e30a9b.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:
modelSelectionLocked: trueremain excluded. Canonical RPC admission and revalidation enforce this; tool visibility is not the security boundary.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:
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.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.