Skip to content

feat: continue dashboard sessions from CLI URLs - #120893

Merged
steipete merged 18 commits into
mainfrom
steipete/session-url-cli
Aug 9, 2026
Merged

steipete merged 18 commits into
mainfrom
steipete/session-url-cli

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Implements the CLI ingestion layer of #120492.

What Problem This Solves

Operators can copy a dashboard session URL, gateway-host shorthand, or bare session ref into the CLI and continue the same Gateway-owned session without reconstructing a WebSocket URL, a full session key, or an environment-variable handoff.

Why This Change Was Made

This adds one typed CLI parser for dashboard URLs, host shorthand, and bare refs; wires positional targets into openclaw tui and openclaw attach; and routes bare-root openclaw <url> directly through the TUI option path. It also gives the connection/resolve path actionable version-skew and origin-aware errors, removes the Control UI gateway-scope compatibility shim after migrating its remaining importer, and documents both continuation modes.

The error matrix distinguishes an older Gateway's closed-object rejection, a missing session, an unreachable named origin (including a *.ts.net Tailscale hint), and a revoked device token while preserving TLS pin failures unchanged. Remote not-found guidance points to the exact Gateway Control UI because openclaw sessions list currently has no --url option.

ClickClack session-URL deduplication and the plugin-SDK session-URL re-export were split into #120810 and are intentionally absent from this PR.

Named follow-up: insufficient stored device scope does not yet expose a typed call-layer reason. That is outside the requested error matrix and is not changed here.

User Impact

Users can now run openclaw tui <url|host/ref|ref>, openclaw attach <url|host/ref|ref>, or the bare-root openclaw <url> form and reach the intended remote session with direct, origin-scoped connection options. Failures now explain the relevant recovery path instead of collapsing into a generic connection or resolution error.

Evidence

  • 423 original focused tests passed across parser, TUI/attach wiring, bare-root routing, error mapping, and Control UI navigation/preferences coverage.
  • 30 package lifecycle tests passed after moving the private URL contract to build-only dependency ownership.
  • A fresh normal clone passed frozen install, core typecheck, full build, built-parser runtime smoke, and packed-manifest omission/restoration proof.
  • The all-lanes changed check passed.
  • The full build passed.
  • Final autoreview completed with no actionable findings.
  • Source-blind contract validation passed.
  • Heavy proof used a clean-clone local fallback because the Blacksmith CLI was absent.
  • LOC: production/config +794/-157; tests +788/-1; docs +79/-3.

Candidate follow-up: the Control UI still scopes short-link resolution by the decorative URL agent in ui/src/pages/chat/route-loader-short-resolve.ts; this PR intentionally leaves that shipped #120512 behavior unchanged while the CLI moves to agent-independent resolution.

Product scope

Bare-root openclaw <url> and positional URL/ref targets on openclaw tui and openclaw attach are intentional grammar, complementary continuation surfaces to openclaw resume-style flows. Refs and URLs support cross-gateway, browser-to-terminal handoff of a session link and deliberately reuse the Control UI URL contract. This is the repository-owner-approved design in #120492.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Aug 9, 2026
@steipete
steipete marked this pull request as ready for review August 9, 2026 04:50
@steipete
steipete requested a review from a team as a code owner August 9, 2026 04:50
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: b94aa9150c058e5b0c6101279bf95bc4c5d67e4b
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts docker Docker and sandbox tooling labels Aug 9, 2026
@steipete steipete self-assigned this Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 4:46 PM ET / 20:46 UTC.

ClawSweeper review

What this changes

Adds dashboard URL, host/reference, and bare-reference targets to TUI, attach, and bare-root CLI flows, resolving them through the selected Gateway.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still accepts only existing TUI and attach session inputs, while this PR adds the missing dashboard-to-CLI continuation flow. The patch has no supported correctness finding, but GitHub reports a dirty merge state and this maintainer-authored, protected PR needs exact-head reconciliation before landing.

Priority: P2
Reviewed head: 1310db9cfecf4c205e0dc48ba397402a8f3cb529

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and focused coverage are strong, but the current dirty merge state requires exact-head validation before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work; the PR body supplies extensive focused and exact-head CI validation, while final proof must be refreshed after conflict resolution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work; the PR body supplies extensive focused and exact-head CI validation, while final proof must be refreshed after conflict resolution.
Evidence reviewed 6 items Current main lacks the requested CLI target surface: Current main registers TUI without a positional target and forwards only existing options such as --session; the requested URL/ref ingestion is not already implemented.
Canonical target parsing and resolution: The branch reuses the session-URL contract, rejects credential-bearing URLs, and resolves short or literal references through the Gateway rather than duplicating Control UI lookup behavior.
Global-session owner is carried at the grant boundary: The branch records an explicit agent only for the canonical global session and passes it into the bound MCP request context, preserving the existing no-spoofed-header boundary.
Findings None None.
Security None None.

How this fits together

CLI session targets are parsed into a Gateway origin, agent, and session reference, then resolved by the Gateway before TUI or a scoped attach grant uses the resulting canonical session. The selected session and agent owner feed terminal behavior and MCP tool scope.

flowchart LR
  A[Dashboard URL or session reference] --> B[CLI target parser]
  B --> C[Gateway connection and origin auth]
  C --> D[Gateway session resolver]
  D --> E[Terminal UI]
  D --> F[Scoped attach grant]
  F --> G[MCP tool context]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports a dirty merge; reconciliation must preserve current-main behavior and rerun exact-head validation for URL-selected session and global-agent ownership.
  • Complete next step (P2) - The protected maintainer-authored PR has a dirty merge state and needs maintainer-led reconciliation, not an automated repair job.
Agent review details

Security

None.

PR surface

Source +673, Tests +1046, Docs +76, Config +1, Generated 0, Other +168. Total +1964 across 40 files.

View PR surface stats
Area Files Added Removed Net
Source 17 863 190 +673
Tests 11 1057 11 +1046
Docs 2 79 3 +76
Config 2 2 1 +1
Generated 1 10 10 0
Other 7 180 12 +168
Total 40 2191 227 +1964

Review metrics

Metric Value Why it matters
Production versus test delta production/config +794/-157; tests +788/-1; docs +79/-3 The production growth implements three CLI continuation entry paths plus canonical global-session ownership, with substantial focused coverage.
Continuation entry paths 3 added: bare-root URL, tui target, attach target All three paths must preserve the same Gateway-origin, session-resolution, and agent-owner invariant.

Stored data model

Persistent data-model change detected: persistent cache schema: src/cli/attach-cli.ts, serialized state: scripts/package-manifest.mjs, serialized state: src/cli/session-ref.test.ts, serialized state: src/cli/session-ref.ts, serialized state: src/cli/session-target.ts, serialized state: src/config/sessions/main-session-key.ts, and 6 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #120492
Summary: This PR is the implementation candidate for the canonical dashboard-session-to-CLI continuation feature.

Members:

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

Merge-risk options

Maintainer options:

  1. Reconcile session-continuation behavior before merge (recommended)
    Resolve the dirty merge and rerun exact-head continuation and attach-grant checks so the selected Gateway session and global-session agent remain correctly associated.

Technical review

Best possible solution:

Rebase and resolve the branch against current main while retaining the canonical parser → Gateway resolver → session/agent-owner flow, then validate the resolved head.

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

Not applicable: this PR adds a new continuation capability rather than repairing a reported existing-behavior bug; current-main source confirms the target grammar is absent.

Is this the best way to solve the issue?

Yes, subject to merge reconciliation: the branch reuses the canonical session URL parser and Gateway-owned resolver rather than adding client-side session-list inference.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded operator workflow addition whose current merge conflict blocks normal landing but does not establish an urgent regression.
  • merge-risk: 🚨 session-state: The patch converts a URL-selected agent and reference into TUI state and an attach-grant context, so incorrect conflict resolution could associate work with the wrong session or agent.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work; the PR body supplies extensive focused and exact-head CI validation, while final proof must be refreshed after conflict resolution.

Evidence

What I checked:

  • Current main lacks the requested CLI target surface: Current main registers TUI without a positional target and forwards only existing options such as --session; the requested URL/ref ingestion is not already implemented. (src/cli/tui-cli.ts:12, bff0494f33b2)
  • Canonical target parsing and resolution: The branch reuses the session-URL contract, rejects credential-bearing URLs, and resolves short or literal references through the Gateway rather than duplicating Control UI lookup behavior. (src/cli/session-target.ts:179, 1310db9cfecf)
  • Global-session owner is carried at the grant boundary: The branch records an explicit agent only for the canonical global session and passes it into the bound MCP request context, preserving the existing no-spoofed-header boundary. (src/gateway/mcp-grant-store.ts:122, 1310db9cfecf)
  • Dependency and packaging review: The new private session-URL contract is a workspace development dependency; the packaging helper removes workspace dev dependencies only in the temporary published manifest and restores the original bytes. (scripts/package-manifest.mjs:19, 1310db9cfecf)
  • Feature provenance: The merged Gateway short-reference resolver dates to the related feature commit, and blame shows the current attach and TUI session-owner paths were recently maintained by the same contributor. (src/gateway/server-methods/attach.ts:31, 0b85f9c174c9)
  • Merge gate: The supplied GitHub state reports this exact PR head as dirty/merge-conflicted, so clean CI on the branch is not proof for the final merge result. (1310db9cfecf)

Likely related people:

  • steipete: Merged Gateway short-reference work and current-main blame for the attach and TUI session-owner paths identify this contributor as the central history owner. (role: feature owner and recent area contributor; confidence: high; commits: 0b85f9c174c9, 5ec12b1330ae; files: src/gateway/sessions-resolve.ts, src/gateway/server-methods/attach.ts, src/tui/tui.ts)

Rank-up moves

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

  • Resolve the GitHub merge conflicts and rerun the continuation and attach-grant checks on the resulting head.

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 (7 earlier review cycles)
  • reviewed 2026-08-09T05:43:03.989Z sha 7fa7b41 :: found issues before merge. :: [P1] Preserve global-scope dashboard sessions | [P1] Keep short-link resolution independent of the URL agent | [P2] Sanitize the private dependency on every pack path
  • reviewed 2026-08-09T08:44:36.542Z sha 292fa96 :: found issues before merge. :: [P1] Preserve the URL agent for global TUI sessions
  • reviewed 2026-08-09T09:40:17.538Z sha 894521e :: needs changes before merge. :: [P1] Preserve the URL agent for global TUI sessions
  • reviewed 2026-08-09T11:43:54.895Z sha 1079a29597824c252451484b42a5cb78a54670ff :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T12:40:14.599Z sha 930f6be :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T12:54:03.353Z sha 930f6be :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T18:49:07.111Z sha 33ec8ee :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Aug 9, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 9, 2026
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the steipete/session-url-cli branch from 894521e to e5baff0 Compare August 9, 2026 11:07
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added 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: 🦐 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. labels Aug 9, 2026
@steipete
steipete force-pushed the steipete/session-url-cli branch from 82509c0 to b94aa91 Compare August 9, 2026 23:24
@steipete
steipete merged commit 055a2dc into main Aug 9, 2026
125 checks passed
@steipete
steipete deleted the steipete/session-url-cli branch August 9, 2026 23:44
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
* feat(cli): ingest session targets

* refactor(ui): remove gateway scope shim

* docs(cli): document session targets

* fix(cli): classify session target failures

* fix(cli): keep session target result private

* fix(cli): simplify timeout option warning

* build: declare session URL contract dependency

* fix(cli): parse bare session URL options symmetrically

* fix(cli): preserve command-owned URL arguments

* build: keep session URL contract build-only

* fix: address session URL review findings

* test: preserve session key mock exports

* fix: keep session URL helpers internal

* fix(tui): preserve URL agent for global sessions

* fix(tui): keep URL agent input internal

* fix(gateway): reconcile websocket protocol owner

* fix(attach): preserve global session agent ownership

* fix(attach): enforce global owner at grant boundary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes commands Command implementations dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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