fix(minder): never exit 2 from the policy hook

Description

Claude Code reads exit status 2 from a PreToolUse hook as a decision to block the tool call. glab exits 2 when it cannot read its configuration file, and Go exits 2 on a panic, so either would block every tool call. This MR makes glab minder policy pre-tool-use report a configuration it cannot read and exit 0, and recover from a panic and exit 0, so the call proceeds under the developer's own permission rules.

glab detects the hook from its arguments before it reads the configuration. Flags may come before the command, but a command that only takes the hook's words as arguments, such as glab api, is not mistaken for it. This is part of https://gitlab.com/gitlab-org/gitlab/-/work_items/634679 and is stacked on !4473.

Known limit: a panic in another goroutine still exits with status 2.

How has this been tested?

Unit tests cover the exit status and message of a configuration failure for the hook and for other commands, and the detection of the hook from glab's arguments, including flags before it and commands that only take its words as arguments. I also ran the built binary with a broken configuration file.

Merge request reports

Loading
Loading