Repository navigation
feat(factorydroid): map hook failClosed to onFailure - #3913
Merged
Merged
Conversation
Factory Droid's hooks reference documents a per-hook `onFailure` field
("continue" by default, or "block"), which makes a failing hook block the
event the way exit code 2 would on PreToolUse, PostToolUse,
UserPromptSubmit and PreCompact. rulesync dropped the canonical
`failClosed` for Droid without a warning.
Emit `failClosed: true` as `onFailure: "block"` on those events, omit
`false` as the default, and read `"block"` / `"continue"` back on import.
A `true` on an event where Droid ignores the field is dropped with a
warning.
Refs #3414
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Assert failClosed maps to onFailure: "block" on preToolUse, postToolUse, beforeSubmitPrompt and preCompact, and revert unrelated command path edits in the commandRegex tests. Refs #3414 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ctorydroid-hook-onfailure # Conflicts: # src/generated/docs-content.ts
dyoshikawa
deleted the
resolve-issue-3414-factorydroid-hook-onfailure
branch
November 20, 2026 02:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Factory Droid's hooks reference now documents a per-hook
onFailurefield:"continue"(the default) or"block". With"block", a hook that cannot start, times out, exits with a code other than 0 or 2, or prints JSON that cannot be applied blocks the event the way exit 2 would. This works onPreToolUse,PostToolUse,UserPromptSubmitandPreCompact. It has no effect onStop,SubagentStopor the events that cannot block. Until now rulesync dropped the canonicalfailClosedfor Droid without a warning.Source: https://docs.factory.com/harness/hooks#block-when-a-hook-fails
Changes:
FACTORYDROID_CONVERTER_CONFIGgets akeywordPassthroughFieldsentry, using the same mechanism as the Claude Code, Goose and ZCode mappings:failClosed: trueis written asonFailure: "block"onpreToolUse/postToolUse/beforeSubmitPrompt/preCompact.falseis omitted because it is the default."block"reads back astrueand"continue"asfalse.trueon an event where Droid ignores the field is dropped with a warning, in both directions.failClosedparagraph indocs/reference/file-formats.mdand the generateddocs-content.tsare updated.Remaining items in #3414
permissionRules. This needs a maintainer design decision because the feature is org-gated and every rule needs tests. Authoring and importingpermissionRulesthrough thefactorydroidoverride already landed in feat(factorydroid): round-trip native permissionRules through the override #3447.docs.factory.ailinks todocs.factory.com. Page paths changed as well, so each link has to be mapped to its new page.preserveRiskLevelthroughfactorydroid.hooks.Tests
src/features/hooks/factorydroid-hooks.test.tscover:"block","continue"and an invalid value.pnpm cicheckpasses.Refs #3414
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4