Loading
feat(govern): sync Codex sessions from the Codex Stop hook
What does this MR do and why?
Adds glab minder audit sync --hook codex, for a Codex Stop hook. Codex sessions are now synced after each turn, rather than only by the fallback periodic sync.
- The hook reads the session ID, transcript path and directory from the JSON Codex passes on stdin, and starts glab in the background to sync that session, so Codex does not wait for the upload. A shell
&can't do this, because a command it starts gets an empty stdin. - The hook prints nothing and never fails, because Codex reads a Stop hook's output as a reason to continue.
- The background glab syncs the session the same way the other hooks do (redaction, cursor, identity,
sync_type: hook), and records it, so--alldoesn't discover it again. - If Codex is not enabled with
glab minder setup --agents codex, the hook syncs nothing, the same as--all. - A hook run sends no telemetry and doesn't check for updates, so the agent is not kept waiting and nothing is printed.
Installing the hook with glab minder setup, and removing it with --uninstall, is a follow-up.
The background glab runs glab minder audit sync, following the rename in !4301 (merged). The telemetry and update-check skip also matches the legacy glab govern audit sync --hook, so hooks that call the old name behave the same way.
Refs https://gitlab.com/gitlab-org/gitlab/-/work_items/635602
How to set up and validate locally
- Run
glab minder setup --agents codex. - Turn on Codex hooks (
[features] hooks = truein~/.codex/config.toml), and add a Codex Stop hook that runsglab minder audit sync --hook codex. - Run a Codex session in a GitLab project, and check that the session appears in GitLab after each turn.
Edited by Jay McCure