Skip to content

hooks@0.3.42

Latest

Choose a tag to compare

@gram-bot gram-bot released this 29 Oct 14:40
· 123 commits to main since this release
b23d304
fix: capture the user prompt of OpenClaw Codex-harness turns (#8092)

## Why

After a Codex sign-in, OpenClaw runs `openai/*` turns on its Codex
app-server harness. That harness never fires `before_agent_run`. It
fires `llm_input` with the prompt instead, which the OpenClaw plugin did
not subscribe. Those sessions showed tool calls and the reply, but no
user message.

## What changed

- **Before:** the shim reported the prompt only from `before_agent_run`,
so Codex-harness turns had no user message.
- **After:** the shim also forwards `llm_input`, observe-only with no
gate deadline, without its history, system prompt and tool list. The
relay reports that prompt as `prompt.submitted` once per `runId`, and
only when `before_agent_run` did not already report the run. Built-in
harnesses still report and gate the prompt on `before_agent_run`. The
relay remembers at most 1024 runs. It reports only the user's text from
that prompt, not the workspace context the harness puts before it.
- Prompt policies cannot block Codex-harness turns, because OpenClaw
fires no gate there. The code and the OpenClaw runbook say so.
- On the built-in runtime `agent_end` can arrive just before the run's
last `llm_output`, which dropped the final reply. The shim now waits up
to 2 seconds for that `llm_output`, so the reply is kept.
- `hooksGeneratorVersion` goes to 54. The relay half takes effect with
the next `speakeasy-hooks` release pin.


## Merge gates

This PR remains draft pending the [required live OpenClaw
checks](https://github.com/speakeasy-api/gram/pull/8092#pullrequestreview-5653810812):

- [x] API-key mode: named agent session with exactly one user message,
tool call/output, and assistant reply; narrated recording attached here.
- [x] Claude subscription mode: the same live session evidence and
recording.
- [x] Codex subscription mode: the same live session evidence and
recording.
- [ ] Release `speakeasy-hooks` with this relay change and advance the
published binary pin; coordinate the generator version with the other
OpenClaw PRs.

The normal release workflow publishes hooks after merge and opens a
separate pin PR. The current `0.3.37` pin cannot capture these prompts;
the release and shim rollout need coordinated sequencing before this
feature is considered delivered.

## API-key recording

Local stack, OpenClaw 2026.10.6 in Docker, OpenRouter API key on
`openrouter/anthropic/claude-haiku-5.5` (built-in runtime). Same plugin
and branch-built `speakeasy-hooks` as below. Agent Sessions shows one
user message, the `exec` call and output, and the reply.



https://github.com/user-attachments/assets/565f19fe-1b2b-4d78-9683-837cc8c96a57



## Claude subscription recording

Local stack, OpenClaw 2026.10.6 in Docker, signed in with a Claude setup
token (`claude setup-token`, an Anthropic token profile) on
`anthropic/claude-haiku-5-5`, built-in runtime. Same plugin and
branch-built `speakeasy-hooks`. Agent Sessions shows one user message,
the `exec` call and output, and the reply. The Claude CLI runtime
(`agentRuntime: claude-cli`) is not covered here; the runbook describes
its partial coverage.



https://github.com/user-attachments/assets/b1ed4846-ef9a-4d55-84d9-9dd9f3284fe2



## Codex subscription recording

Local stack, OpenClaw 2026.10.6 in Docker, signed in with Codex on
`openai/gpt-5.6-luna`. The plugin comes from this branch's generator,
and a `speakeasy-hooks` built from this branch replaces the pinned
0.3.37. Agent Sessions shows one user message, the `exec` call and
output, and the reply.



https://github.com/user-attachments/assets/69464ef7-643d-46ca-b1f4-63695c76b63d



## Narrated before/after demonstration

Supplementary local relay evidence: actual binaries from base `4559629d`
and this PR process the same synthetic `llm_input` frames. Before: no
prompt. After: exactly one prompt, no duplicate, and no raw model
context. This recording does not satisfy the three live-authentication
merge gates above.


https://github.com/user-attachments/assets/203db6b4-a25b-4784-b7f3-d332e97e3807

---------

Co-authored-by: Georges Haidar <ghaidar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>