Repository navigation
feat(plugins): report tool names, skills used and model iterations on agent_end - #190108
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR adds available tool names, used skills, and known model-call counts to agent_end hooks. Example: A Codex turn reads the workspace skill deploy and makes 3 model calls with read and skill_workshop available.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a useful plugin contract, resolves both prior findings, and has passing checks on the reviewed head; no actionable defect remains. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent finalizers pass completed-run facts through the shared harness side-effects owner to Skill Workshop scheduling and plugin observation hooks. flowchart TD
A[Embedded runner] --> C[Agent end preparation]
B[Codex runtime] --> C
D[Run skill receipts] --> C
C --> E[Workshop scheduler]
C --> F[Plugin hook dispatch]
F --> G[Incognito projection]
Technical reviewBest possible solution: Use the existing agent-end preparation owner to publish optional run facts while preserving SDK aliases, Workshop behavior, and Incognito filtering. Do we have a high-confidence way to reproduce the issue? This is a capability addition; current-main source confirms the facts remain private, and review inspected source and supplied tests without running target code. Is this the best way to solve the issue? The change extends existing hook and receipt owners, migrates bundled callers together, and preserves shipped input compatibility without adding a parallel subsystem. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4475bed8cf50. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +69, Tests +107, Docs +18. Total +194 across 18 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 1, 2026, 2:30 AM ET / 07:30 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 1621a2d.
|
… agent_end (openclaw#190108) ## Problem Skill Workshop is moving from core into the bundled `skill-workshop` plugin. Its post-turn review needs three facts about the finished run that the public `agent_end` hook does not carry: - which OpenClaw tools the model could call (today a Workshop-only `skillWorkshopAvailable` flag on the internal side-effects context), - which skills the run used (today a core-private per-run receipt), - how many model calls the run made (today `ctx.modelIterations`, set by Codex only). ## Fix - **`agent_end` event:** new optional `skillsUsed` (`name`, `source`, `activation`) and `modelIterations`. - **`agent_end` context:** new optional `toolNames`: the OpenClaw tools the model could call this turn, after policy. - **One preparation step:** `runAgentEndSideEffectsAsync` / `awaitAgentEndSideEffects` consume the run's skill-usage receipt once and give the same event to core and plugin hooks. The hook message loader stays bound to the prepared event. - **Producers:** the embedded runner reports `toolNames` from the prompt-policy callable surface (after any `before_prompt_build` `toolsAllow`, keeping tool-search-deferred tools); Codex reports its dynamic tool names and `modelIterations` only when it observed responses. agentsapi drops its hard-coded `skillWorkshopAvailable: false`. - An unknown `modelIterations` is left off the event, never reported as `0`. - **Workshop scheduler** reads `ctx.toolNames`, `event.modelIterations` and `event.skillsUsed`; `skillWorkshopAvailable` is gone from core and bundled callers. - **Shipped SDK compatibility:** `ctx.skillWorkshopAvailable` and `ctx.modelIterations` on the agent-end side-effects helpers stay as deprecated aliases (warning, supported through 2026-12-31) that map onto `toolNames` and `event.modelIterations`. - **Privacy:** Incognito sessions withhold `skillsUsed` and `modelIterations` along with messages. - `hook-types.ts` was at its line cap, so the terminal agent-run payloads moved to `hook-agent-finalize.types.ts` (re-exported unchanged). - Docs: hook reference, Incognito note, harness side-effects page. No new SDK entry points or named exports. No schema, protocol or stored-data change. ## Impact - Plugins can see what a finished run did without core-private state. Second consumers: skill-usage analytics, cost or turn-budget plugins, memory plugins checking their tools were exposed. - Workshop reviews keep their current behavior on embedded and Codex runs. ## Evidence | Check | Result | | --- | --- | | New: plugin hooks get `skillsUsed`, `modelIterations` and `toolNames`; the message loader stays bound; core and plugins see the same event (`agent-end-side-effects.test.ts`) | pass; fails when the loader transfer is removed | | New: retired `ctx.modelIterations` / `ctx.skillWorkshopAvailable` map onto `event.modelIterations` / `ctx.toolNames` and leave the context | pass | | Incognito `agent_end` withholds `skillsUsed` and `modelIterations` (`wired-hooks-llm.test.ts`) | pass | | Workshop scheduler, review admission, embedded attempt lifecycle, Codex agent-end context, CLI skill usage | pass (6 files, 66 tests) | | All 14 `*.workshop-contract` suites, unchanged | pass (104 tests) | | Embedded: a prompt hook narrowing the bundle to `read` reports `toolNames: ["read"]` (`attempt-phase-lifecycle.test.ts`) | pass; fails on the bundle-based version | | Codex: a turn without per-response notifications leaves `modelIterations` unknown | pass; fails with the old `?? 0` | | `pnpm check:changed` (typecheck, lint, boundaries, line-cap ratchet) | pass | | `plugin-sdk:api:diff` vs `origin/main` | additive optional fields only; no new or removed exports | | `git diff --check` | pass | Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
Skill Workshop is moving from core into the bundled
skill-workshopplugin. Its post-turn review needs three facts about the finished run that the publicagent_endhook does not carry:skillWorkshopAvailableflag on the internal side-effects context),ctx.modelIterations, set by Codex only).Fix
agent_endevent: new optionalskillsUsed(name,source,activation) andmodelIterations.agent_endcontext: new optionaltoolNames: the OpenClaw tools the model could call this turn, after policy.runAgentEndSideEffectsAsync/awaitAgentEndSideEffectsconsume the run's skill-usage receipt once and give the same event to core and plugin hooks. The hook message loader stays bound to the prepared event.toolNamesfrom the prompt-policy callable surface (after anybefore_prompt_buildtoolsAllow, keeping tool-search-deferred tools); Codex reports its dynamic tool names andmodelIterationsonly when it observed responses. agentsapi drops its hard-codedskillWorkshopAvailable: false.modelIterationsis left off the event, never reported as0.ctx.toolNames,event.modelIterationsandevent.skillsUsed;skillWorkshopAvailableis gone from core and bundled callers.ctx.skillWorkshopAvailableandctx.modelIterationson the agent-end side-effects helpers stay as deprecated aliases (warning, supported through 2026-12-31) that map ontotoolNamesandevent.modelIterations.skillsUsedandmodelIterationsalong with messages.hook-types.tswas at its line cap, so the terminal agent-run payloads moved tohook-agent-finalize.types.ts(re-exported unchanged).No new SDK entry points or named exports. No schema, protocol or stored-data change.
Impact
Evidence
skillsUsed,modelIterationsandtoolNames; the message loader stays bound; core and plugins see the same event (agent-end-side-effects.test.ts)ctx.modelIterations/ctx.skillWorkshopAvailablemap ontoevent.modelIterations/ctx.toolNamesand leave the contextagent_endwithholdsskillsUsedandmodelIterations(wired-hooks-llm.test.ts)*.workshop-contractsuites, unchangedreadreportstoolNames: ["read"](attempt-phase-lifecycle.test.ts)modelIterationsunknown?? 0pnpm check:changed(typecheck, lint, boundaries, line-cap ratchet)plugin-sdk:api:diffvsorigin/maingit diff --check