Skip to content

fix(hooks): show eventless status consistently - #116127

Merged
steipete merged 2 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/local-hooks-eventless-info-status
Aug 2, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/local-hooks-eventless-info-status

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where eventless hooks were classified correctly by openclaw hooks check, but openclaw hooks list and openclaw hooks info still described the same state as a generic missing-requirements problem.

Why This Change Was Made

The CLI now reuses the hook status blockedReason for human list and info output, while keeping true missing-requirement hooks labeled as missing requirements.

User Impact

Operators see the actionable reason no events defined consistently across hook status commands.

Evidence

  • pnpm test src/cli/hooks-cli.test.ts src/hooks/hooks-status.test.ts
  • Head SHA: 70decfe1ee783c9803815a8e501e31820cc313f4
  • Local preflight passed on the rebased branch against current main.
  • GitHub checks were green before the rebase; this update refreshes exact-current-main verification.
  • Real CLI base/head proof ran pnpm openclaw hooks list and pnpm openclaw hooks info eventless-demo against the same isolated hook fixture.
  • Exact-head negative control ran pnpm openclaw hooks info missing-req-demo and kept true missing-requirement output unchanged.
base list:
Hooks (0/2 ready)
| x missing | eventless-demo | Eventless proof hook | openclaw-managed |

base info:
eventless-demo x Missing requirements
  Blocked reason: no events defined

head list:
Hooks (0/2 ready)
| x no events defined | eventless-demo | Eventless proof hook | openclaw-managed |

head info:
eventless-demo x No events defined
  Blocked reason: no events defined

head negative control:
missing-req-demo x Missing requirements
  Environment: x DEMO_HOOK_TOKEN

Additional module-boundary proof imported src/cli/hooks-cli.ts directly and confirmed eventless list/info output now uses the blocked reason while missing-requirement output remains unchanged.

proof-live.ts
import { createRequire } from "node:module";
import { formatHookInfo, formatHooksList } from "./src/cli/hooks-cli.ts";
import type { HookStatusReport } from "./src/hooks/hooks-status.ts";
import { createEmptyInstallChecks } from "./src/cli/requirements-test-fixtures.ts";

const require = createRequire(import.meta.url);
require.extensions[".css"] = () => "";

const baseHook = {
  name: "session-memory",
  description: "Save session context to memory",
  source: "openclaw-bundled",
  pluginId: undefined,
  filePath: "/tmp/hooks/session-memory/HOOK.md",
  baseDir: "/tmp/hooks/session-memory",
  handlerPath: "/tmp/hooks/session-memory/handler.js",
  hookKey: "session-memory",
  emoji: undefined,
  homepage: undefined,
  events: ["command:new"],
  unknownEvents: [],
  always: false,
  enabledByConfig: true,
  requirementsSatisfied: true,
  loadable: true,
  blockedReason: undefined,
  managedByPlugin: false,
  ...createEmptyInstallChecks(),
} satisfies HookStatusReport["hooks"][number];

const eventlessReport = {
  workspaceDir: "/tmp/workspace",
  managedHooksDir: "/tmp/hooks",
  hooks: [
    {
      ...baseHook,
      events: [],
      loadable: false,
      blockedReason: "no events defined",
    },
  ],
} satisfies HookStatusReport;

const missingRequirementReport = {
  ...eventlessReport,
  hooks: [
    {
      ...baseHook,
      requirementsSatisfied: false,
      loadable: false,
      blockedReason: "missing requirements",
      requirements: { ...baseHook.requirements, env: ["DEMO_HOOK_TOKEN"] },
      missing: { ...baseHook.missing, env: ["DEMO_HOOK_TOKEN"] },
    },
  ],
} satisfies HookStatusReport;

const eventlessList = formatHooksList(eventlessReport, {});
const eventlessInfo = formatHookInfo(eventlessReport, "session-memory", {});
const missingRequirementInfo = formatHookInfo(
  missingRequirementReport,
  "session-memory",
  {},
);

console.log(
  `eventless-list-status=${eventlessList.includes("no events defined") ? "blocked-reason" : "missing"}`,
);
console.log(
  `eventless-info-status=${eventlessInfo.includes("No events defined") ? "blocked-reason" : "missing-requirements"}`,
);
console.log(
  `negative-control=${missingRequirementInfo.includes("Missing requirements") ? "missing-requirements" : "changed"}`,
);

AI-assisted: built with Codex

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Jul 29, 2026
@sunlit-deng
sunlit-deng marked this pull request as ready for review July 29, 2026 23:49
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 7:04 PM ET / 23:04 UTC.

ClawSweeper review

What this changes

The branch makes openclaw hooks list and openclaw hooks info show an enabled-but-eventless hook’s specific blocked reason instead of describing it as missing requirements.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 4 items remain

This PR remains necessary: current main still derives blockedReason: "no events defined" for an eventless hook but renders generic missing-requirements headlines in hooks list and hooks info. The patch correctly presents the producer-owned reason and preserves disabled-hook handling; no discrete code defect was found. Before merge, it needs a redacted terminal transcript from the current head f2a6d402, because the posted base/head evidence is for the earlier 70decfe1 revision and does not prove the disabled-hook compatibility adjustment.

Priority: P3
Reviewed head: f2a6d402dca34cfd4c1b4e8cae728ea1380db9ad

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-compatible, but the real behavior evidence does not cover the current head revision.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR includes a useful redacted terminal transcript and negative control for 70decfe1, but it does not show real CLI behavior from exact current head f2a6d402, which added disabled-hook compatibility; post a redacted current-head transcript before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR includes a useful redacted terminal transcript and negative control for 70decfe1, but it does not show real CLI behavior from exact current head f2a6d402, which added disabled-hook compatibility; post a redacted current-head transcript before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main status contract: The status owner computes loadable from enabled state, requirements, and declared events, then records no events defined when an otherwise eligible hook has no events.
Current-main user-visible mismatch: Current list status falls back to ✗ missing, while current info output falls back to ✗ Missing requirements; both lose the eventless reason even though the same report retains it.
Existing sibling behavior: The existing hooks check formatter already displays non-requirement blocked reasons, and its current test fixture asserts session-memory - no events defined, establishing the intended CLI wording pattern.
Findings None None.
Security None None.

How this fits together

Hook discovery combines workspace and plugin-managed hook metadata into one status report. The hooks CLI then turns that report into list, info, and check output for operators, so it should preserve the status owner’s recorded reason rather than collapse distinct non-ready states.

flowchart TD
  A[Workspace and plugin hook metadata] --> B[Hook status evaluation]
  B --> C[Blocked reason recorded]
  C --> D[Hooks check output]
  C --> E[Hooks list output]
  C --> F[Hooks info output]
  E --> G[Operator diagnosis]
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR includes a useful redacted terminal transcript and negative control for 70decfe1, but it does not show real CLI behavior from exact current head f2a6d402, which added disabled-hook compatibility; post a redacted current-head transcript before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The current-head compatibility adjustment for disabled hooks has not been demonstrated in a real CLI run; the existing transcript proves the prior revision only.
  • Resolve merge risk (P1) - The branch is behind current main and the supplied check summary includes a failed lint/gate run, so merge readiness should be refreshed after rebasing rather than inferred from earlier green checks.
  • Complete next step (P2) - No mechanical repair is needed; the contributor must refresh exact-head real-behavior proof and the branch/check state before ordinary maintainer merge review.
Agent review details

Security

None.

PR surface

Source +17, Tests +76. Total +93 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 19 2 +17
Tests 1 76 0 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 95 2 +93

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase the focused formatter-and-test change onto current main, retain the single producer-owned blockedReason presentation path, and attach a redacted exact-head CLI transcript covering eventless, missing-requirement, and disabled-hook cases.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase the focused formatter-and-test change onto current main, retain the single producer-owned blockedReason presentation path, and attach a redacted exact-head CLI transcript covering eventless, missing-requirement, and disabled-hook cases.

Do we have a high-confidence way to reproduce the issue?

Yes—source provides a high-confidence path: an enabled hook with events: [] receives blockedReason: "no events defined", while current list and info formatters still use generic missing wording. The existing eventless status fixture supplies the focused regression shape, although no test or CLI command was run in this read-only review.

Is this the best way to solve the issue?

Yes—the proposed boundary is the CLI presentation layer, which should reuse the authoritative status reason rather than infer readiness from separate fields. The PR also preserves the established disabled and true-missing-requirements wording paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against eb8c22ed13f9.

Labels

Label justifications:

  • P3: This is a small operator-facing CLI wording correction with a bounded blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR includes a useful redacted terminal transcript and negative control for 70decfe1, but it does not show real CLI behavior from exact current head f2a6d402, which added disabled-hook compatibility; post a redacted current-head transcript before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main status contract: The status owner computes loadable from enabled state, requirements, and declared events, then records no events defined when an otherwise eligible hook has no events. (src/hooks/hooks-status.ts:116, eb8c22ed13f9)
  • Current-main user-visible mismatch: Current list status falls back to ✗ missing, while current info output falls back to ✗ Missing requirements; both lose the eventless reason even though the same report retains it. (src/cli/hooks-cli.ts:113, eb8c22ed13f9)
  • Existing sibling behavior: The existing hooks check formatter already displays non-requirement blocked reasons, and its current test fixture asserts session-memory - no events defined, establishing the intended CLI wording pattern. (src/cli/hooks-cli.test.ts:114, eb8c22ed13f9)
  • PR implementation scope: The PR changes the list and info presentation paths to reuse a non-requirement blockedReason, while keeping the established missing-requirements wording for actual unmet requirements and keeping disabled hooks on their existing branch. (src/cli/hooks-cli.ts:113, f2a6d402dca3)
  • History and ownership: Blame ties the current formatter block to the locally available hook-status introduction, and file history shows repeated CLI/hooks maintenance by the likely routing candidates. (src/cli/hooks-cli.ts:113, 9aceb1620d4f)
  • Proof gap at exact head: The PR body’s CLI transcript names 70decfe1, but the current head is f2a6d402, whose follow-up commit preserves disabled-hook compatibility. The prior review correctly requested current-head proof for that adjustment. (src/cli/hooks-cli.ts:117, f2a6d402dca3)

Likely related people:

  • Jesse Merhi: The locally available provenance ties the current hook-status contract, CLI presentation, and eventless coverage to the same introduction commit. (role: current status-and-CLI implementation introducer; confidence: high; commits: 9aceb1620d4f; files: src/hooks/hooks-status.ts, src/cli/hooks-cli.ts, src/cli/hooks-cli.test.ts)
  • steipete: The current PR head includes a follow-up compatibility adjustment authored by this contributor, and local history shows sustained work in the hooks CLI area. (role: recent compatibility-path contributor; confidence: high; commits: f2a6d402dca3, c791e2b1280e; files: src/cli/hooks-cli.ts, src/cli/hooks-cli.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Post a redacted f2a6d402 terminal transcript for eventless list/info output plus missing-requirement and disabled-hook negative controls.
  • Rebase onto current main and refresh the affected checks before maintainer merge review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-07-29T23:53:23.127Z sha f42bbbec7eb9b6db3efc3054f46fb5db6dfc305b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T00:28:09.106Z sha 70decfe :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T22:28:05.199Z sha f2a6d40 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T08:58:07.245Z sha f2a6d40 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T14:23:59.506Z sha f2a6d40 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T17:42:53.235Z sha f2a6d40 :: needs real behavior proof before merge. :: none

@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/local-hooks-eventless-info-status branch from f42bbbe to 70decfe Compare July 30, 2026 00:23
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 31, 2026

Copy link
Copy Markdown
Contributor

Land-ready; thanks @sunlit-deng for the focused fix. Verified contributor head f2a6d402dca34cfd4c1b4e8cae728ea1380db9ad.

Real on-disk hook definitions were parsed through the production status owner and every human/JSON CLI formatter:

  • Enabled eventless hook: missing requirements before → no events defined in both hooks list and hooks info after.
  • Enabled hook with an actual missing requirement: existing missing-requirements status unchanged.
  • Disabled hook: existing disabled status unchanged; hooks check and JSON remain consistent.

Focused proof:

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/cli/hooks-cli.test.ts src/hooks/hooks-status.test.ts

Result: 15 passed. Full-branch structured review found no actionable issues. Exact-head hosted CI is green, including check-lint and openclaw/ci-gate: https://github.com/openclaw/openclaw/actions/runs/30669770961 (attempt 3).

@steipete
steipete merged commit 9517b10 into openclaw:main Aug 2, 2026
276 of 291 checks passed
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit to yetval/openclaw that referenced this pull request Aug 2, 2026
…r-117788-empty-startup-race

* commit '9517b10778ba69b94471cb1f122a5f1e19aa22a4':
  fix(hooks): show eventless status consistently (openclaw#116127)
  refactor(cli): consolidate security-sensitive regression fixtures (openclaw#114411)
  perf(plugins): list from installed metadata (openclaw#117900)
  fix(memory): remove interrupted Dreaming sessions after Gateway restart (openclaw#117885)
  test(gateway): reuse startup plugin metadata snapshot (openclaw#117897)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* fix(hooks): show eventless status consistently

* fix(hooks): preserve disabled hook status compatibility

Co-authored-by: sunlit-deng <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants