Repository navigation
fix(hooks): keep error text on failure events - #1499
Conversation
Signed-off-by: Indra Prasetya <[email protected]>
Signed-off-by: Indra Prasetya <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
The nine hook tests pass and the Codex mirror matches. The pinned Biome check fails on both hook copies.
zlareb1
left a comment
There was a problem hiding this comment.
The unit job rejects two candidate limits in enrich.py. The same assertion fails on the CI base and on clean main, and passes with the repair. Failed unit job · Repair #1503
Line 139 of the source hook exceeded the repository's 120-column limit. Reformat it and regenerate the mirrored Codex hook copy. Signed-off-by: Indra Prasetya <[email protected]>
zlareb1
left a comment
There was a problem hiding this comment.
The hook records the top-level failure text through the existing redaction and length limit. All nine focused tests, the plugin mirror check, and the pinned Biome format check pass on this head.
zlareb1
left a comment
There was a problem hiding this comment.
Both failed unit shards reproduce on the CI base without the hook change. The coding profile assertion passes on main with #1507. The limit gate rejects two enrichment bounds and two fixed request caps. #1503 tracks the limit repair.
Coding profile job · Merged profile fix · Limit job · Limit repair
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
Failed tool calls in Claude Code sessions now record the error text in the observation. An
action:errorevent shows why the call failed instead of an empty error field.Why
Refs #1481
A
PostToolUseFailureevent carries its error in the top-levelerrorfield and has notool_response.buildObservationread the error only fromtool_response, soerrorwas an empty string. The observation recorded that a call failed but not why. The fix readspayload.errorfirst and keeps the existingtool_responsefallbacks for clients that report errors there, so both event shapes are covered.Scope and risk
Only the Claude Code hook's error selection and its mirrored Codex copy change. Tool input, output, redaction, dedupe and the shape of the observation are untouched. A client that sends both fields now sees the top-level text it reported for the failure. Both plugin manifests move from 1.2.53 to 1.2.54; no other open pull request uses that version.
Compatibility, rollout and rollback
errorfield of anaction:errorobservation is now populated for one event shape.Tests
A regression test in
integrations/claude-code-plugin/tests/loom-capture.test.mjsbuilds an observation from aPostToolUseFailurepayload with only a top-levelerror. Before the fix it failed withactual: ''; after the fix it passes.Verification
Commands and results on this checkout, based on
upstream/mainat96b4870c6:$ node --test integrations/claude-code-plugin/tests/loom-capture.test.mjs
before the fix: 8 pass, 1 fail (the new case,
actual: '')after the fix: 9 pass, 0 fail
$ node --test integrations/claude-code-plugin/tests/*.test.mjs
719 tests, 712 pass, 0 fail
$ python3 scripts/codegen/agent_plugin_sync.py --check
codex plugin copies are current
$ python3 -m pytest tests/unit/test_codex_plugin.py -q
could not collect: the local environment lacks server dependencies (
opentelemetry.instrumentation). Version parity was read directly from both manifests: both report 1.2.54.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): opencode-go:hy4-flash-free. I checked the failing case before the change, the passing suite after, the mirrored Codex copy and the version numbers.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.Note
Low Risk
Narrow client-side fix in capture hooks plus version bump and a unit test; no server or wire changes.
Overview
Failed tool calls now persist the real failure message in Loom observations.
buildObservationin the Claude Code and Codex capture hooks checkspayload.errorfirst when building the observation’serrorfield, then keeps the existing fallbacks ontool_responseso both event shapes still work.PostToolUseFailureevents often ship only a top-levelerrorand notool_response, which lefterrorempty before.action:errorobservations should now show why the call failed.Both plugin manifests are bumped to 1.2.54, and a regression test covers a
PostToolUseFailurepayload with only top-levelerror.Reviewed by Cursor Bugbot for commit 63cab67. Bugbot is set up for automated code reviews on this repo. Configure here.