Skip to content

fix(hooks): let Stop continue false finish the turn - #41

Merged
vincentkoc merged 3 commits into
openclaw:mainfrom
SebTardif:fix/stop-continue-false
Oct 1, 2026
Merged

vincentkoc merged 3 commits into
openclaw:mainfrom
SebTardif:fix/stop-continue-false

Conversation

@SebTardif

@SebTardif SebTardif commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve Sebastien Tardif's finalizer-only fix: a Stop result with
    continue: false no longer requests another pass.
  • Add explicit per-hook precedence and upgrade documentation to README and
    docs/compatibility.md, plus registered-handler regression coverage.
  • Related issue: none. No unrelated feature work is included.

Compatibility And Maintainer Decision

  • Source apps: Claude Code and Codex; surface: before_agent_finalize.
  • Accepted for 0.1.1: installed Stop hooks returning continue: false
    finish the turn after upgrade instead of requesting revision.
  • Precedence is per hook, not global. continue: false outranks a block
    on that same result. A separate blocking result still requests revision,
    regardless of hook order.
  • Exit-2 and oversized-input Stop decisions still revise. Pre-tool and
    prompt handling still treat continue: false as blocking.
  • No new trust permission, dependency, manifest, command name, or install
    ownership change. Shared hookBlock semantics remain unchanged.

The earlier PR description incorrectly said README had no compatibility table.
It does; its table is now updated. The owner explicitly accepted this upgrade
behavior in the reviewed 0.1.1 campaign scope on October 1, 2026.

Verification

Exact candidate: 6381d6c1697ded3921a431a0eca16e248286f3ea.
Original contributor head: a66b5fda0cbcbc3846fd6ace378d039cea221888.

  • Focused src/index.test.ts and src/bundle-plugins.test.ts: 54 passed.
  • npm run check: build and 144 tests passed across 11 files.
  • npm run pack:check: 24 files, 279628 bytes unpacked.
  • README compatibility table, reference, and credited changelog.
  • Private data and generated outputs excluded from the diff.
  • Independent exact-head review: no actionable introduced findings at 6381d6c.
  • Fresh hosted gates and ClawSweeper verdict are required before merge.

Main was integrated only after #43's squash merge caused a real changelog
conflict. Both credited changelog entries are retained; no contributor history
was rewritten.

Real Behavior Proof

Executed on October 1, 2026, Node 26.8.1 / npm 11.19.1 / Python 3.14.6 /
macOS arm64. Tests register the production Babelfish entry with isolated
plugin state and invoke its actual registered handlers. Temporary command
hooks execute through the process supervisor.

Fixture Registered-handler outcome
Stop continue:false finish (undefined)
Stop decision:"block" action:"revise" with reason/retry
both on the same Stop hook finish
separate continue/block hooks, both orders revise
exit-2 Stop hook revise
oversized Stop input revise with 1 MiB payload-limit reason
PreToolUse continue:false block
UserPromptSubmit continue:false block
npx vitest run src/index.test.ts src/bundle-plugins.test.ts
npm run check
npm run pack:check

This is registered-handler/process proof, not a claim of a live Gateway session.
Original contribution and history retained. Thanks @SebTardif.

Claude Code treats continue false as a full stop and gives it
precedence over a Stop decision. hookBlock still reports that value
as a block for pre-tool and prompt hooks, but finalization turned
every Stop block into revise, so a finished hook sent the agent back
to work.

A Stop hook with decision block still revises. A hook that sets both
continue false and decision block finalizes.

The registered finalizer covers both Stop outputs.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 5:35 AM ET / 09:35 UTC (Revision 3).

ClawSweeper review

What this changes

Babelfish lets imported Stop hooks finish a turn when they return continue: false, with per-hook precedence, regression coverage, and compatibility documentation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. Both prior review blockers are resolved: README documents the precedence, and the maintainer explicitly accepted the upgrade behavior. No actionable introduced defect remains.

Priority: P2
Reviewed head: 6381d6c1697ded3921a431a0eca16e248286f3ea

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant production-process proof, resolved prior feedback, and an explicitly accepted upgrade tradeoff.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The reported macOS run uses the production registered finalizer, plugin discovery, and real supervised hook processes, observing completion, independent revision guards, and preserved failure handling. The maintainer expressly confirms this bounded harness evidence. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The reported macOS run uses the production registered finalizer, plugin discovery, and real supervised hook processes, observing completion, independent revision guards, and preserved failure handling. The maintainer expressly confirms this bounded harness evidence. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The main-to-pinned-head delta changes only finalizer decision handling, two test files, and compatibility documentation; unrelated MCP work is already in the base.
Still necessary on main and release: Current main and v0.1.0 both convert every Stop block, including continue:false, into revision. Neither contains the proposed finalizer filter.
Prior documentation finding resolved: README now describes installed-hook upgrade behavior and same-hook precedence, including independent blocks in either order; the compatibility reference and changelog agree.
Findings None None.
Security None None.

How this fits together

Babelfish translates imported Claude Code and Codex hook results into OpenClaw lifecycle decisions. Its finalization handler determines whether a turn can finish or needs another revision.

flowchart TD
 A[OpenClaw turn finalization] --> B[Run imported Stop hooks]
 B --> C[Collect hook results]
 C --> D[Exclude results with continue false]
 D --> E{Remaining blocking result}
 E -->|Yes| F[Request revision]
 E -->|No| G[Allow finalization]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +7/-3; tests +118/-0 The small finalizer repair has focused coverage for precedence and preserved failure behavior.

Technical review

Best possible solution:

Keep finalization precedence local to each Stop result while preserving independent revision guards and existing prompt/tool blocking.

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

Yes, from source: current main maps a Stop result containing continue:false through hookBlock into revision. The recorded production-handler run verifies the repaired result; this read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. Filtering only the finalizer's individual continue:false results repairs completion without changing shared blocking semantics or suppressing separate guards.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5fdda0b28cf6.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded imported-hook compatibility repair affecting turn completion.
  • merge-risk: 🚨 compatibility: Installed Stop hooks change behavior on upgrade; the maintainer explicitly accepted that documented tradeoff for 0.1.1.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The reported macOS run uses the production registered finalizer, plugin discovery, and real supervised hook processes, observing completion, independent revision guards, and preserved failure handling. The maintainer expressly confirms this bounded harness evidence. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported macOS run uses the production registered finalizer, plugin discovery, and real supervised hook processes, observing completion, independent revision guards, and preserved failure handling. The maintainer expressly confirms this bounded harness evidence. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The main-to-pinned-head delta changes only finalizer decision handling, two test files, and compatibility documentation; unrelated MCP work is already in the base. (src/index.ts:618, 6381d6c1697d)
  • Still necessary on main and release: Current main and v0.1.0 both convert every Stop block, including continue:false, into revision. Neither contains the proposed finalizer filter. (src/index.ts:618, 5e2ccd634980)
  • Prior documentation finding resolved: README now describes installed-hook upgrade behavior and same-hook precedence, including independent blocks in either order; the compatibility reference and changelog agree. (README.md:48, 6381d6c1697d)
  • Accepted compatibility tradeoff: vincentkoc explicitly accepted installed Stop hooks changing from revision to finalization, limited to per-hook continue:false precedence, with separate blocking hooks preserved: fix(hooks): let Stop continue false finish the turn #41 (comment). This resolves the prior maintainer-decision blocker. (6381d6c1697d)
  • Production-path process proof: The captured body and maintainer comment report an October 1 macOS arm64 run exercising the actual registered handlers and real command-hook subprocesses. Source confirms isolated plugin discovery, production registration, process execution, same-hook and independent-hook outcomes, exit-2 and oversized-input revision, and unchanged prompt/pretool blocking. No live Gateway session is claimed or required for this bounded translation. (src/index.test.ts:292, 6381d6c1697d)
  • Failure decisions remain effective: Exit-2 and oversized-input failures produce standalone decision:block results without continue:false, so the introduced filter preserves them. Shared hookBlock behavior remains unchanged. (src/bundle-plugins.ts:810, 6381d6c1697d)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-30T15:40:51.420Z sha a66b5fd :: blocked before merge. :: [P3] Update the README compatibility table
  • reviewed 2026-09-30T15:54:38.516Z sha a66b5fd :: blocked before merge. :: [P3] Update the README compatibility table

@SebTardif
SebTardif marked this pull request as ready for review September 30, 2026 15:50
@vincentkoc vincentkoc self-assigned this Oct 1, 2026
Comment thread src/index.test.ts
for (const [index, result] of decisions.entries()) {
await fs.writeFile(
path.join(pluginRoot, `hook-${index}.mjs`),
`process.stdin.resume(); process.stdin.on("end", () => { console.log(${JSON.stringify(JSON.stringify(result))}); process.exitCode = ${options.exitCode ?? 0}; });`,
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Exact candidate 6381d6c1697ded3921a431a0eca16e248286f3ea.
The README finding is fixed and the prior incorrect statement about the table
is removed. The owner explicitly accepts the installed Stop-hook upgrade:
per-hook continue:false precedence only, with separate blocking hooks still
requesting revision in either order. No additional maintainer decision is
outstanding under the authorized 0.1.1 campaign.

Registered-handler proof includes same-hook precedence, conflicting hooks in
both orders, exit-2/oversized-input revision and unchanged prompt/pretool blocks.
Focused 54/54, full 144/144 and package gates pass. Independent exact-head review
reports no actionable findings. Main integration resolved only the real
changelog conflict after the preceding MCP repair merged.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit bf8695c into openclaw:main Oct 1, 2026
8 of 9 checks passed
@SebTardif
SebTardif deleted the fix/stop-continue-false branch October 1, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants