Repository navigation
feat: add user input blocking lifecycle gates - #75035
Conversation
|
Codex review: passed. Summary Reproducibility: not applicable. as a feature PR rather than a current-main bug report. Current main lacks Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the exact reviewed head through the existing maintainer/automerge path once branch protection accepts it. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR rather than a current-main bug report. Current main lacks Is this the best way to solve the issue? Yes. Placing the gate after prompt construction but before image loading, What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c4537fa6c3ca. |
Summary
before_agent_runlifecycle hook before provider submission.hooks.allowConversationAccess=true.llm_input,llm_output, future turn context, and visible agent fallback replies.Validation
pnpm test src/plugins/hook-lifecycle-gates.test.ts src/plugins/loader.test.ts src/agents/pi-embedded-runner/run.incomplete-turn.test.ts src/agents/pi-embedded-runner/run/attempt.test.ts src/agents/cli-runner.reliability.test.ts src/gateway/server-methods/chat.directive-tags.test.ts src/gateway/session-utils.fs.test.ts src/gateway/session-history-state.test.ts src/gateway/sessions-history-http.revocation.test.ts src/gateway/session-message-events.test.ts ui/src/ui/chat/message-normalizer.test.tspnpm test src/agents/model-fallback.test.ts src/agents/pi-embedded-runner/run.incomplete-turn.test.ts src/agents/pi-embedded-runner/run/attempt.test.tspnpm test src/agents/pi-embedded-runner/run/attempt.spawn-workspace.context-engine.test.ts src/agents/pi-embedded-runner/run/attempt.test.ts src/plugins/hook-lifecycle-gates.test.tspnpm tsgo:prodpnpm check:test-typespnpm protocol:checkpnpm config:docs:checkgit diff --checkReal behavior proof
Behavior or issue addressed:
before_agent_runhooks can block user input before model submission while keeping the transcript redacted and avoiding downstream hook/model leakage.Real environment tested: Local OpenClaw dev gateway from this PR branch on macOS, Control UI webchat, temporary local
hitl-testplugin withhooks.allowConversationAccess=true, configured to block prompts containinghitl,block, orsecret.Exact steps or command run after this patch: Built runtime and Control UI, launched
node dist/entry.js --dev gateway run --force --verbose, openednode dist/entry.js --dev dashboard, sent blocked webchat prompts containing the HITL trigger text, and inspected/tmp/openclaw/openclaw-2026-05-05.log.Evidence after fix: Redacted live gateway log excerpt from the local run:
Observed result after fix: The blocked turn completed without provider/model submission, did not emit
llm_input/llm_output, persisted only the redacted user message, and after the final patch did not show a duplicate agent bubble orAgent failed before replyfallback.What was not tested: Full Testbox
pnpm check:changedwas not rerun locally during this follow-up; focused tests and local live gateway proof above covered the changed behavior.