Skip to content

v4.2.1 — TaskCreated hook tolerates stringified metadata - #62

Merged
NOGIT007 merged 1 commit into
mainfrom
fix/task-created-hook-metadata-string
May 12, 2026
Merged

NOGIT007 merged 1 commit into
mainfrom
fix/task-created-hook-metadata-string

Conversation

@NOGIT007

Copy link
Copy Markdown
Contributor

Summary

  • Hook scripts/task-created-tag-check.sh rejected valid TaskCreate calls when the Claude Code harness delivered tool_input.metadata as a JSON-encoded string instead of an object. The jq path .tool_input.metadata.user_story silently returned empty in that case, even though the caller supplied user_story / layer correctly.
  • Fix normalizes metadata before extracting fields — if it's a string, parse via fromjson?; otherwise pass through. Same downstream validation either way (US-<N> / AC-<N>.<M> / chore:<reason> plus the Rust layer check).
  • Verified against five payload shapes: object form, two string forms (US-1 + AC-1.2), empty payload, bogus tag. Accepted shapes pass; invalid shapes still reject with the original error.

Test plan

  • Object metadata → exit 0
  • Stringified metadata (US-1, domain) → exit 0
  • Stringified metadata (AC-1.2, interface) → exit 0
  • Empty metadata → exit 2 (rejects)
  • Stringified metadata with bogus tag → exit 2 (rejects)

🤖 Generated with Claude Code

The Claude Code harness sometimes delivers tool_input.metadata as a
JSON-encoded string rather than an object. The original jq path
.tool_input.metadata.user_story silently returned empty in that case,
rejecting valid TaskCreate calls with "required metadata is missing
or invalid".

Normalize first: if metadata is a string, parse it via fromjson?;
otherwise pass through. Same downstream validation either way.

Verified across five payload shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NOGIT007
NOGIT007 merged commit 2b6a086 into main May 12, 2026
1 check passed
@NOGIT007
NOGIT007 deleted the fix/task-created-hook-metadata-string branch May 12, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant