-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalyze_payload6.py
More file actions
47 lines (40 loc) · 1.44 KB
/
analyze_payload6.py
File metadata and controls
47 lines (40 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Check what Claude Code received back from Read tool calls."""
import json
import os
base = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs/2026-03-03_16-03-20/2026-03-03/pipeline/payloads')
files = sorted(os.listdir(base))
for fn in files:
if not fn.endswith('_request.json'):
continue
rid = fn.replace('_request.json', '')
req_path = os.path.join(base, fn)
res_path = os.path.join(base, f'{rid}_response.json')
with open(req_path) as f:
req = json.load(f)
msgs = req.get('messages', [])
tcs = None
text = ''
if os.path.exists(res_path):
with open(res_path) as f:
res = json.load(f)
tcs = res.get('tool_calls')
text = res.get('response_text', '')
tc_summary = ''
if tcs:
for tc in tcs:
fn_info = tc.get('function', {})
tc_summary = f'{fn_info.get("name","?")} args={fn_info.get("arguments","?")[:80]}'
elif text:
tc_summary = f'TEXT: {text[:100]}'
else:
tc_summary = 'EMPTY'
last_user = ''
for m in reversed(msgs):
if m.get('role') == 'user':
c = m.get('content', '')
if isinstance(c, str):
last_user = c[:120].replace('\n', '\\n')
break
print(f'{rid}: msgs={len(msgs):2d} => {tc_summary}')
if 'error' in last_user.lower() or 'missing' in last_user.lower():
print(f' LAST_USER_MSG: {last_user}')