Commit graph

9 commits

Author SHA1 Message Date
Tobin South
248331e0fe
Merge pull request #56 from dazzaji/fix/handoff-regex-truncation
Fix handoff_request extractor truncating nested payloads at the first `}`
2026-05-28 17:48:21 -07:00
Tobin South
efc8d4edf9
Merge pull request #41 from akhilesharora/fix/deploy-mktemp-template
Fix mktemp template so deploy-managed-agent.sh runs on Linux
2026-05-28 17:48:17 -07:00
Dazza Greenwood
88c8906831
Fix handoff_request extractor truncating nested payloads at the first }
`HANDOFF_RE` used a non-greedy `.*?\}`, so the match ended at the first
closing brace. Every real `handoff_request` nests objects (`payload`,
and `payload.params`), so the captured substring was truncated
mid-object and `json.loads` raised — `extract_handoff` rejected every
well-formed handoff as `invalid_json` before the target allowlist and
schema validators ever ran. In practice the cross-agent handoff path
did not function for any realistic payload.

Replace the full-match regex with a start anchor (`HANDOFF_START_RE`)
and extract the complete object with `json.JSONDecoder().raw_decode`,
which is string- and brace-nesting aware and returns exactly one
complete JSON value plus its end offset. Multi-line payloads now parse
as well. The audit log's `raw_len` field, previously `len(m.group(0))`,
is now derived from the decoded object's span (`end - m.start()`), and
its three later uses on the target/schema/params rejection paths are
updated to the new variable. Downstream validation — target allowlist,
payload and per-intent schemas, sanitize/frame — is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:56:41 -07:00
Daniel Law
c705e020f3
Stamp metadata.anthropic_cookbook on managed-agent deploys 2026-05-20 23:34:07 +00:00
Akhilesh Arora
bf6aea18bb
Fix mktemp template so deploy-managed-agent.sh runs on Linux
GNU mktemp wants 3+ X's in a -t template. The bare `mktemp -t skillcache`
and `mktemp -t skill` calls worked on macOS but crash on Linux before
the script does anything. test-cookbooks.sh fails the same way for all
5 cookbooks because it calls deploy --dry-run.

Adding .XXXXXX is portable: GNU expands the X's, BSD treats them as
prefix. Confirmed on Ubuntu 24.04 / coreutils 9.4: test-cookbooks goes
0/5 -> 5/5.
2026-05-16 20:26:41 +02:00
Matt Piccolella
78abd16e99
Add CLA workflow, CONTRIBUTING note, and align copyright header format 2026-05-11 15:55:23 -07:00
Matt Piccolella
22649cf9aa
Add copyright and SPDX license headers to scripts 2026-05-11 14:02:12 -07:00
Matt Piccolella
f7ccda739f
Tighten handoff param patterns to block prompt injection via spaces
Param values for matter_id and clause are interpolated directly into the
steering-prompt templates. Their patterns previously permitted spaces, which
would let a hostile document smuggle a natural-language sentence into the
prompt through a field that looks like an ID. Restrict both to slug shape
(no spaces); descriptive context belongs in the note/event fields, which are
never interpolated and are wrapped in the data frame.

Also render templates via format_map with an empty-string default so an
optional param the template references (e.g. playbook_monitor's clause)
degrades gracefully instead of raising KeyError, and ignore __pycache__.
2026-05-11 13:50:41 -07:00
Matt Piccolella
d541734b08
Initial commit of Claude for Legal 2026-05-11 13:44:26 -07:00