fix: let an agent's baked hooks key outrank a cached sign-in
DNO-1422
Summary
Mark a baked hooks key as an agent identity key with agent_key, so it outranks a cached personal sign-in on both live events and offline replay. An explicit hooks API key still wins. An organization-key override replaces the baked key and clears the agent flag, allowing a matching personal cache to win; replay applies environment credentials only within their deployment.
Include the agent flag in the publish snapshot so a change in credential identity regenerates the plugin configuration. Existing shared-key snapshots remain unchanged. Agent plugins skip automatic browser login, and the environment-overrides runbook describes the credential order and attribution consequences.
Motivation
An agent installed on a machine with a cached personal login must keep its own event identity. The explicit generator flag distinguishes an agent key from a shared organization key without guessing from the credential string.
No production generator sets HooksKeyIsAgent: true yet. The agent plugin generator in #8088 still needs to set it. The relay change also requires a hooks binary release and the follow-up version pin before existing installations receive it.
This changes credential resolution and generated configuration, without adding an API or user action. Existing Platform MCP tools and shipped skills remain sufficient.
Narrated technical demo
Current head 62edc82f05259bbb626b683321c7d6a45f949f85: a local test-runner screen executes six existing relay tests freshly with -count=1, using synthetic fixtures and an isolated HTTP test server. It shows live agent-key priority, the explicit API-key override, config loading, offline replay and organization-key fallback, then cross-deployment isolation. The footage trims idle holds and includes synthesized narration.
This is a technical test demonstration, not a deployed OpenClaw session or Agent Sessions attribution check. Delivery still needs the hooks release, version pin, and generator integration.
During preparation, one combined run's live-priority test saw three requests where it expected two. The failure did not recur in 30 isolated runs or 10 combined diagnostic runs; its cause remains unresolved. Temporary diagnostic logging was removed, and all six tests passed in the recorded fresh executions. No source code was changed.
https://github.com/user-attachments/assets/78fd81c9-a654-4d29-9962-b340eb4d26c6