fix(minder): stop syncing an open session once its hooks are removed

Description

A Claude Code session that was already open when the user ran glab minder setup --uninstall kept running glab minder audit sync --silent from its Stop hook, because Claude Code reads its hooks when a session starts. That command took the single-session path of runSync, which never checked whether syncing is paused. It wrote the session's record again, so gaig/cursors came back after uninstall said the records were removed, and it uploaded the session.

The single-session path now checks the agent's paused reason first, as --hook and --all already do. When syncing is paused, it writes nothing, uploads nothing, and prints the reason unless --silent is set. When the check itself fails, for example because ~/.claude/settings.json can't be read, it also syncs nothing and returns the error, like the other failures on this path. For Claude Code, paused means the glab Stop hook is not in ~/.claude/settings.json, the same rule --all uses.

The help for --all now says that removing the hooks also pauses an agent session that was already open. Five tests ran this path without the agent set up, so they now enable Codex, install the Claude Code Stop hook, or install the OpenCode plugin, as a real setup does.

Closes https://gitlab.com/gitlab-org/cli/-/work_items/8773

How has this been tested?

A new test runs the sync for an open Claude Code session after the glab hooks are removed, from the hook and by hand. It checks that nothing is uploaded, that no session record is written, and that the reason is printed only without --silent. It fails without this change. Another test checks that a settings file glab can't read stops the sync with an error.

go test ./internal/commands/govern/audit/sync/...

Merge request reports

Loading
Loading