mirror of
https://github.com/lukaszraczylo/claude-adam.git
synced 2026-10-17 05:58:10 +00:00
fix(observe): do not fingerprint successful file-tool responses
errorFingerprint() ran ERROR_RE over Read, Edit and Write success objects. Source files that contain words such as error or failed then produced raw: fingerprints and false tool_error_loop signals: 151 entries across 9 sessions. PostToolUse never receives failed calls, because Claude Code sends them to PostToolUseFailure. Return null for objects with a file or filePath key and no is_error: true. String responses keep their fingerprints. Proposed by ADAM /reflect (2026-09-25-002). Tests 36b and 36c added: 147 passed, 0 failed. Claude-Session: https://claude.ai/code/session_014prTNuJnKuwcAd28vUZAnN
This commit is contained in:
@@ -249,6 +249,12 @@ function snapshotContext(state) {
|
||||
|
||||
function errorFingerprint(toolResponse) {
|
||||
if (!toolResponse) return null;
|
||||
// Read/Edit/Write success objects carry `file`/`filePath` and no `is_error`.
|
||||
// PostToolUse never receives failed calls (CC routes them to
|
||||
// PostToolUseFailure), so ERROR_RE here would only match source-file text.
|
||||
if (typeof toolResponse === "object" && !Array.isArray(toolResponse) &&
|
||||
toolResponse.is_error !== true &&
|
||||
("file" in toolResponse || "filePath" in toolResponse)) return null;
|
||||
let text = "";
|
||||
if (typeof toolResponse === "string") text = toolResponse;
|
||||
else if (toolResponse.content !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user