Skip to content

fix: let an agent's baked hooks key outrank a cached sign-in - #8109

Closed
speakeasyforgebot wants to merge 4 commits into
mainfrom
cursor/agent-key-outranks-hooks-cache-da9f
Closed

speakeasyforgebot wants to merge 4 commits into
mainfrom
cursor/agent-key-outranks-hooks-cache-da9f

Conversation

@speakeasyforgebot

@speakeasyforgebot speakeasyforgebot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

demo-narrated.mp4

A plugin's speakeasy.json can now mark its hooks_api_key as an agent's own key (agent_key). The hooks relay and the spool drain then use that key ahead of a cached speakeasy-hooks login, so an agent installed on a machine where a person signed in keeps its events under the agent. SPEAKEASY_AI_HOOKS_API_KEY still wins, and an org key from SPEAKEASY_AI_HOOKS_ORG_KEY is never treated as an agent's. The generator gains GenerateConfig.HooksKeyIsAgent to write the flag; published plugin output is unchanged.

Co-authored-by: Forge Bot <speakeasyforgebot@users.noreply.github.com>
@speakeasyforgebot
speakeasyforgebot requested a review from a team as a code owner October 26, 2026 17:14
@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

DNO-1422

@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 62edc82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/runbooks/hooks-environment-overrides.md
Comment thread docs/runbooks/hooks-environment-overrides.md
Comment thread docs/runbooks/hooks-environment-overrides.md Outdated
Comment thread hooks/relay/drain.go
Comment thread server/internal/plugins/hooks_bootstrap.go
@mfbx9da4

Copy link
Copy Markdown
Contributor

Folded into #8108, which now targets main as a single PR with all of this change.

@mfbx9da4 mfbx9da4 closed this Oct 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants