Skip to content

atomic agent hooks grok: every hook from a real Grok 1.0.60 session fails with 'duplicate field hook_event_name' #290

Open

Description

@mrhinkle

Summary

With Atomic 0.20.0 and the atomic-grok integration (758c750), every hook call from a real Grok Build 1.0.60 session fails to parse its input, so no turn is recorded and nothing is attested. Hooks I drove by hand with my own JSON payloads worked, so the parser seems to disagree with what Grok actually sends.

Environment

  • Atomic 0.20.0 (atomic-aarch64-apple-darwin.tar.gz from the v0.20.0 release)
  • atomic-grok at 758c750e84f4ad8ea2b02886789fda26fe846e37, atomic-skills at 7030496b784347d27bab8ea0d8f50236c03e0f78, both installed with atomic agent enable --agent grok --from <checkout> --from-skills <checkout>
  • Grok Build 1.0.60 (stable)
  • macOS 26.6.2, arm64

Steps to reproduce

  1. Create a Git repo with a couple of commits and run atomic git import.
  2. atomic identity new <name> --set-default, then the atomic agent enable command above.
  3. Make the hooks visible to Grok in the repo (.grok/hooks/atomic.json, copied from the installed file); grok inspect lists 6 hooks.
  4. Run grok --always-approve --max-turns 4 -p "Append one line saying hello to a.txt, then stop." with atomic on PATH.

Expected

The turn is recorded as an Atomic change on a draft view, and atomic agent attest -s reports it as AI-authored (xAI / Grok Build).

Actual

Grok edits the file and fires all six hooks. atomic agent status reports failing: post-tool, pre-tool, session-end, session-start, stop, user-prompt-submit. The log has, for each event:

Internal error: Failed to parse hook input for grok stop: Failed to parse hook input for grok (turn_end): duplicate field `hook_event_name`
exit_code=128

atomic agent attest -s stays at AI-authored: 0%.

Calling atomic agent hooks grok <event> by hand with a minimal payload such as {"session_id":"s1","cwd":"...","prompt":"..."} works: the turn is recorded and attest reports 100% AI-authored.

I did not capture Grok's raw payload, so I can't say which of its fields is duplicated. Happy to capture it if useful.

Related observations (same test, lower priority)

  • Import cost on a larger history. atomic git import of a 1,114-commit repo ran at about 1.8 s/commit and was still slowing at roughly 300 commits (about 190 s per 100 commits). .atomic was already 445 MB against a 227 MB .git. I stopped it at 15 minutes, and afterwards the repo would not open: repository operation is still completing; retry with a writable repository open. A 35-commit repo imported in 27 s, with .atomic at 113 MB against 7.6 MB for .git.
  • Interrupted import leaves the repo unusable. After the kill above, atomic log fails with the "still completing" error. It would help to have a documented recovery (atomic doctor?) or a resumable import.
  • Delegation scope not enforced locally. An agent identity created with atomic identity agent create grok-lane --views "agent-*" --local could still atomic record onto main. Maybe scope is only enforced on push; if so, a note in the docs would help.
  • Tag import. v1.0.0-beta.1 was refused with peels to commit ..., which has no verified Git state binding; refusing to import an unbound tag. It's unclear from the message how to fix that.

Activity

  1. vinceblock99 commented on Nov 13, 2026

    @vinceblock99
    Contributor

    Thanks for the detailed report, @mrhinkle. The hook failure is fixed in #337, now merged to dev. It is not in a release yet: 0.22.1 still has the bug, so the fix will be in the next release after it.

    What was wrong. Grok sends most top-level fields twice in each hook payload, once under its own camelCase key and once under Claude's snake_case key (sessionId and session_id, hookEventName and hook_event_name, and so on). Our parser accepted either spelling but rejected a payload that carried both, so every hook from a real session failed. Your hand-written payloads worked because they used only one spelling. No need to capture the raw payload any more.

    How it was checked. I followed your steps (Git repo, atomic git import, atomic agent enable --agent grok --from … --from-skills … with the same atomic-grok and atomic-skills revisions, then a grok -p session that edits a file) with Grok Build 1.0.60 and 1.0.77:

    Released 0.22.1 With the fix
    atomic agent status all six hooks failing all hooks ok
    Recorded turn none one change, authored by the Grok agent identity
    atomic agent attest -s AI-authored: 0% AI-authored: 100% (xAI / Grok Build)

    One thing you may hit next. In a Git-imported repo, an identity created without an email (atomic identity new <name> --set-default, as in your step 2) makes atomic record end with:

    Git error: cannot construct the local shadow projection for view 'main': … Signature cannot have an empty name or email
    

    The change is still recorded, but the command exits with an error, and the Grok stop hook then shows as failing. This is a separate bug in 0.22.1, not specific to Grok. Until it is fixed, create the identity with an email: atomic identity new <name> -e you@example.com --set-default.

    The four related observations in this issue (import cost, interrupted import, delegation scope, tag import) are not covered by #337, so I'm leaving the issue open for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions