Skip to content

feat(automations): label workspaces a host creates with the desktop's own automation run - #35986

Merged
nwparker merged 2 commits into
mainfrom
feat/34433-host-records-client-automation-provenance
Oct 29, 2026
Merged

nwparker merged 2 commits into
mainfrom
feat/34433-host-records-client-automation-provenance

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​256 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​238
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​177 $\color{#cf222e}{\Huge{\mathbf{−}}}$​37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​140

ELI5

When a desktop's own automation creates its workspace on a managed or paired Orca host, that workspace used to lose its automation identity: no automation badge, and the run's pane closed instead of sleeping when the run finished. Now the desktop tells a capable host "this workspace belongs to my automation run". The host stores that as a label, so the badge and sleep-on-finish work again.

What Changed

  • Desktop: when an automation run creates its workspace on a runtime host that advertises worktree.create.client-automation-provenance.v1, the desktop sends the run as clientAutomationProvenance.
    • It names itself (local) as the automation's owner, so the badge looks the automation up on this desktop.
    • It truncates the name and run-title snapshots to the host's cap.
  • Host: stores the label as automationProvenance with origin: 'client' and a host-stamped createdAt, but only for automations it doesn't hold itself.
    • A malformed or oversized label is dropped with one warning, and the workspace is created plain.
    • Automation store errors still propagate.
  • Invariant: a client-origin label never grants anything on the host. It doesn't:
    • match one of the host's runs (runOwnsWorkspace);
    • put a run's pane to sleep;
    • change how the host creates the workspace (allowLocalBaseFallback and wslUserAct stay as for a plain create).
  • Badge: a client-origin label whose automation can't be found reads "unavailable", not "removed". Another desktop or a phone may not hold that automation.

Why

Only the desktop's own process can check its dispatch token. #34525 stopped sending the token to hosts, and #35978 made hosts accept older desktops that still send it. Both left these workspaces unlabelled. A host can't verify a client's claim either way, so the record is treated as what it is: a cosmetic label. The host stores it but never acts on it.

Earlier I had the desktop check its token before sending. I dropped that: it added IPC and new ways for a run to fail, and gave the host no extra trust. Any paired client could already label its own new workspaces, so trust is unchanged.

Mixed versions:

  • New desktop, old host: no capability, so the field is never sent.
  • Old desktop, new host: the field is absent.

The field is optional, and the host accepts any value and validates it itself, so a bad label can't fail a create.

Linked Issue

Refs #34433

Thanks @nm7-jp for the report.

Visual Proof

N/A. The badge rendering is unchanged; it now appears on these workspaces again. The new "unavailable" state reuses the existing copy ("Automation availability could not be checked.").

Testing

  • New tests, each failing on base:
    • host records a client-origin label without create policy, and drops an oversized label;
    • host surfaces store failures;
    • host run ownership ignores client-origin labels;
    • renderer sends the label only to capable hosts and never sends the token;
    • dispatch names local as the owner;
    • long names are truncated into a valid label;
    • the badge shows "unavailable" for a client-origin miss.
  • Typecheck, the static job, the changed-code quality gate, the test files that import the changed modules (73 files), and the orcad terminal smoke all pass locally.

… own automation run

A desktop's own automation could create its workspace on a managed or paired
host, but the workspace lost its automation identity: no badge, and its run
pane closed instead of sleeping. The desktop now sends a capable host its run
as a label, naming itself (`local`) as the automation's owner. The host
records it with origin 'client', only for automations it does not hold, caps
its fields, and never lets a client-origin label grant run ownership, sleep
authority or automation create policy. Older hosts get nothing new; older
desktops still create plain workspaces. A client-origin label whose
automation can't be found reads as unavailable, not removed.

Refs #34433
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor
Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds automation labels to workspaces that a desktop creates on capable runtime hosts.

  • Desktop automations send their run label to hosts that support it.
  • Hosts store client automation runs as labels, not as their own runs.
  • The workspace badge shows client-owned automation misses as uncheckable.

nwparker explicitly describes other desktops showing “unavailable” as intentional.

Diagram

sequenceDiagram
  participant D as Owning desktop
  participant H as Runtime host
  participant W as Workspace metadata
  D->>H: Check advertised capabilities
  alt Client automation labels supported
    D->>H: Create workspace with clientAutomationProvenance
    H->>H: Check label and exclude host-held automations
    H->>W: Store label with origin client
  else Older host
    D->>H: Create workspace without label
  end
  H-->>D: Return workspace
Loading

Reviews (1) · Last reviewed commit: "test(automations): keep the dropped-labe..." · Reviewed by Greptile

@nwparker
nwparker merged commit 76cb99d into main Oct 29, 2026
49 of 50 checks passed
@nwparker
nwparker deleted the feat/34433-host-records-client-automation-provenance branch October 29, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant