You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Michael Feth
committed
fix(desktop): bound the device stamp to local agents and validate every label
Review follow-up. Four issues, all confirmed against the code first.
**A provider-backed agent was given the wrong location.**
`agent_event_content` stamped the current device onto every record without
consulting `record.backend`. A `Provider` body runs elsewhere -- deployed to a
cluster from a laptop -- and stays online after that laptop sleeps, so the
mention UI told the user "only that device can reply" about a machine that is
not where the agent runs. The stamp is now gated on `BackendKind::Local`.
That alone closes the false guidance: `describeUnrunnableMention` already
returns `null` when no `device_id` is published, so such an agent now produces
no notice at all rather than a corrected one.
Distinguishing key *custody* from *execution* is a protocol change, not a second
stamp, and is left as a named future-work note.
**The label contract was bypassed on stored and inbound data.**
Validation ran only when a label was typed. Three holes:
- `load_or_create_at` returned whatever deserialized. A hand-edited
`device.json` was published unchecked. It now validates the whole identity --
id shape and label -- and an invalid file takes the path a corrupt one
already did: preserved as `device.json.corrupt`, replaced, never failing the
caller.
- The inbound kind:30177 projection forwarded `device_id`/`device_label`
verbatim. Owner authentication proves authorship, not well-formedness; a
sibling device on an older or tampered build can sign anything. Each field is
now validated independently and degrades to `None`, so a bad label never
hides an otherwise reachable agent.
- `char::is_control` is category `Cc` only, so zero-width (U+200B) and bidi
overrides (U+202E) passed through. Rather than a second rule, the label now
goes through `validate_device_label`, reusing the visible-text policy that
already guards agent definition text -- whose own doc comment asks for
validation "at every local, inbound, and publication boundary".
An over-long label is now refused rather than truncated: publishing something
other than what the owner typed is the worse failure.
**Rename claimed more than it did.** It reconciles only the active retention
scope. Republishing every scope needs owner keys for communities that are not
applied -- identity handling, not this command -- so the contract is now stated
truthfully instead: immediate for the active community, eventual elsewhere via
`run_event_sync` on activation.
**The OS host name could be published before the owner saw the warning.**
First-run labels are now opaque (`device-<8 hex>`) and `mint_identity` no longer
reads the host name. It is offered as an explicit opt-in in the settings card
via `get_device_name_suggestion`, so nothing derived from it reaches a relay
until the owner applies it.
The new tests share a process-global cache, so the seam is an RAII guard holding
a mutex and restoring on drop -- deliberately not repeating the pattern that
makes `claude_spawn_uses_the_probed_cli_executable` flaky.
Signed-off-by: Michael Feth <michael@jira-flow.com>
0 commit comments