Skip to content

Recognize "I have created" phrasing in the anti-fabrication guard (#1865) - #1873

Merged
malibio merged 1 commit into
mainfrom
issue-1865-silent-tool-miss
Aug 1, 2026
Merged

malibio merged 1 commit into
mainfrom
issue-1865-silent-tool-miss

Conversation

@malibio

@malibio malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Investigation of #1865 (agent claims it created a node while calling no tool — scenario 8d in the agent-matrix eval) traced the fabricated venue-creation claim to a cascade: an earlier create_schema call in the same chat (scenario 8b) is rejected by validation and never retried, leaving no valid schema for the model to target on the following turn (8d). With no valid tool call available, the model fabricates a success claim instead of surfacing the failure.

The existing anti-fabrication guard (contains_action_claim, from #1345) already catches and suppresses this class of fabricated claim — confirmed live against a fresh run of scenario 8d. The gap: ACTION_PHRASES only matched "i created" / "i've created", not "i have created" — the exact wording quoted in #1865's first transcript. This PR closes that gap for all 8 tracked verbs (created/updated/found/added/deleted/removed/marked/set/made/completed).

The upstream create_schema cascade (8b's validation rejection never gets retried) is a distinct error-recovery bug, filed separately as #1872 — not addressed here.

Changes

Test plan

  • cargo test -p nodespace-agent --lib — 401/401 passed
  • cargo fmt --check / cargo clippy -- -D warnings clean
  • bun run test:all (frontend + skill + Rust, incl. Tauri-seam e2e) — passed through the pre-push gate

🤖 Generated with Claude Code

https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs

…uard

Investigation of #1865 traced the fabricated venue-creation claim to a
cascade: an earlier create_schema call in the same chat is rejected by
validation and never retried, leaving no valid schema for the model to
target on the next turn. With no tool call available, the model
fabricates a success claim instead — verbatim in the "I have created"
phrasing this guard didn't yet recognize (it only matched "I created"
and "I've created"). The upstream create_schema recovery gap is filed
separately as #1872.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
@malibio

malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review Summary

This is a small, well-scoped fix: it adds "i have <verb>" variants to the existing ACTION_PHRASES list in contains_action_claim (packages/agent/src/local_agent/agent_loop.rs) so the anti-fabrication guard catches the exact wording quoted in #1865 ("I have created a new node for..."). Diff is 22 lines, entirely additive, single file, single purpose. Confirmed locally: cargo test -p nodespace-agent --lib action_claim — 5/5 pass, including the new action_claim_detects_have_created_phrasing regression test using the issue's verbatim transcript text. cargo fmt --check and cargo clippy -- -D warnings are both clean.

This is a net positive and I recommend Approve.

Findings

Requirements vs. #1865's acceptance criteria

#1865 has three acceptance criteria:

Net: this PR fully satisfies the one criterion in its stated scope, and correctly does not attempt the other two, which belong to #1872 or to eval verification outside a code diff.

Correctness

  • Verified the call site (line 977): the guard only evaluates on turns with zero real tool calls (!any_real_tool_calls), so there's no risk of this list ever suppressing a legitimate post-tool-call summary that happens to use "I have created" phrasing — that path is structurally excluded regardless of what's in ACTION_PHRASES.
  • The new phrases follow the exact naming/casing pattern of the existing entries (lowercased match against text.to_ascii_lowercase()), so no new false-positive surface was introduced beyond what the existing 3 negative tests (does_not_fire_on_capability_statements, does_not_fire_on_conversational_text) already cover. Spot check: "I have a question" and "I have to check" don't match any of the 8 tracked verb continuations, so no obvious new false positive from this addition.
  • Coverage is symmetric across all 8 verbs (created/updated/found/added/deleted/removed/marked/set/made/completed — actually 10, counting set/made/completed separately) — no verb got the "i have X" variant while another didn't, so the fix isn't partial.

Testing

  • The new test (action_claim_detects_have_created_phrasing) uses the issue's exact transcript quote plus two adjacent verbs (updated, added) as sanity checks that the pattern generalizes across the list, not just the one reported string. That's a reasonable regression-test scope for a lexical fix like this — it doesn't need to re-test all 10 verbs individually since the change is mechanically identical for each.
  • No new negative-path test was added (e.g. "I have a suggestion" not firing) but the existing negative suites already exercise the closest adjacent risk (capability/conversational phrases), and none of the added strings overlap with them. Not blocking.

Maintainability / substance question: is the phrase-list approach sound, or whack-a-mole?

Worth addressing directly since it's the most legitimate architectural question this PR raises.

contains_action_claim's substring-list design predates this PR (shipped in #1345); this PR extends an existing pattern rather than introducing one. A broader refactor to something like a regex (i\s+(?:have|'ve)?\s*(created|updated|found|...)) or a lighter POS-style heuristic would collapse the "I X" / "I've X" / "I have X" triplication and make the next missed contraction (e.g. "I'd created", "I just created") a zero-diff fix instead of a 3-line one. That's a real reduction in future maintenance surface.

That said, I don't think it's this PR's job to make that call:

  • The list was already a hardcoded phrase list before this PR touched it; this PR's entire diff is additive rows in an existing table, not new architecture. Scope creep into a regex rewrite would roughly triple the diff size and mix a refactor with a bug fix in one PR — worth avoiding per its own atomicity.
  • The guard is explicitly documented as "deliberately conservative" (see the doc comment above the function) — a hand-curated list is arguably the right tool for a guard that needs to avoid false positives on "I can" / "I would" / "I could" capability language, which a looser regex risks blurring unless carefully anchored.
  • The actual production risk here is bounded: this is a last-resort safety net (the real fix for this class of failure is Rejected create_schema call has no recovery path — cascades into a phantom type by the next turn #1872 removing the phantom-schema state that provokes fabrication in the first place). A missed phrase degrades to the pre-existing behavior (unguarded fabrication reaches the user) rather than causing new harm, so the cost of incremental patching is a slow trickle, not a live risk multiplying with each release.

🟢 Suggestion (non-blocking): if ACTION_PHRASES grows past this PR's ~10 verbs × 3 person-forms, consider collapsing the triplication into a small regex or a (subject_prefix, verb) cross-product table (e.g. SUBJECTS = ["i ", "i've ", "i have "] × VERBS = ["created", "updated", ...]) so a new verb is a one-line addition rather than a three-line one. Not urgent, and not in scope for this fix — flagging for whoever eventually revisits this list.

Security / Performance

No security surface here — pure string matching against model-generated text already destined for local display, no external input crosses a trust boundary that wasn't already crossed. Performance is a non-issue: ACTION_PHRASES.iter().any(|p| lower.contains(p)) was already O(n·m) before this PR; going from ~30 to ~40 short substrings against typically-short response text is immaterial.

Documentation

PR description and commit message both correctly scope the change and name #1872 as the deferred sibling issue — good practice for reviewers who might otherwise wonder why the routing-cause criterion isn't addressed.

Verdict

Approve. The change does exactly what it says, is minimal and additive, is well-tested against the issue's literal reproduction case, doesn't regress the guard's false-positive protections, and correctly declines to scope-creep into the upstream #1872 fix or a phrase-matching architecture rewrite — both of which are legitimately out of scope for a targeted gap-fill PR.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review posted above. Recommendation: APPROVE — minimal, additive, well-tested fix that correctly stays in scope (defers the create_schema cascade to #1872). Could not submit as a formal approval: GitHub blocks self-approval since the PR and reviewing account share the same identity (malibio).

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