Repository navigation
Add retry-on-validation-error guidance for create_schema (closes #1872) - #1898
Conversation
An earlier create_schema call rejected by validation (e.g. a title_template placeholder missing from fields) had no guidance telling the model to retry with a correction. The model instead asked the user a clarifying question — which TOOL_STRATEGY_RULES already forbids before non-delete operations — so the schema was silently never created, leaving a later turn with no valid type to act on (the root cause behind #1865's fabricated-success cascade). Added SCHEMA_VALIDATION_ERROR_RETRY, parallel to the existing SCHEMA_ALREADY_EXISTS rule, instructing the model to fix the specific problem the error names and retry create_schema in the same turn rather than asking the user or giving up. Regenerated SKILL.md to match. Verified live against 8 trials on a purged, isolated E4B daemon: the model now retries on a validation error rather than asking the user or giving up (5/8 trials hit an error and retried; the other 3 succeeded without needing to). This also surfaced a distinct, unrelated failure mode — the model sometimes retries with malformed JSON it doesn't self-correct — filed separately as #1876, since it's a tool-call- encoding issue rather than a schema-authoring guidance gap. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
Code Review SummaryNet positive, low-risk, well-scoped change. This is a small, additive guidance rule ( FindingsRequirements validation against #1872Both acceptance criteria are satisfied:
Mechanical correctness (independently re-verified, not just trusted from the PR body)
Verification-claims scrutiny (PR body vs. issue thread)The PR body's trial numbers are internally consistent with the fuller breakdown on #1872 (issue comment, second entry): 3/8 trials succeeded without hitting an error at all (not restated in the PR body, only in the issue), 5/8 hit an error and retried (2 "already exists" → success; 3 hit the separate malformed-JSON bug and did not persist a schema). 3 + 2 + 3 = 8, consistent across both places. The PR body appropriately hedges this as "Live-verified... not just unit tests, since this is a guidance-prose change" rather than claiming full closure, and correctly attributes the malformed-JSON failure mode to a distinct, separately-filed issue (#1876) rather than folding it into this PR's claimed success rate. It doesn't overclaim — it doesn't say "8/8 pass" or imply the guidance fully closes the original cascade; it says the guidance is followed in the cases it targets (retry vs. clarify), which is what was actually measured. One improvement suggestion below on making the terse PR-body summary self-contained. Verified the human sign-off is real: three comments from Scope disciplineConfirmed #1876 (malformed-JSON tool-call args) is correctly out of scope here — it's a distinct failure mode (syntactic self-generated JSON malformation the model doesn't recognize as the cause of its own retry failure) that no amount of "fix what the error message says" guidance could reach, since the error text in that case is accurate and the bug is in the model's own encoding, not the schema's semantic content. Correctly filed separately rather than blocking this PR or being scope-crept into it. Suggested Improvements
Nitpicks
VerdictApprove. Requirements met, mechanically verified independently (contamination test, SKILL.md check, full test suite all re-run and passing), consistent with existing architecture and sibling-rule patterns, appropriately scoped, appropriately hedged verification claims, and genuine human sign-off confirmed on the issue thread. No blockers. (Posted via |
malibio
left a comment
There was a problem hiding this comment.
Review verdict: APPROVE (self-approval blocked by GitHub since author = reviewer account). Full review posted as a PR comment above. Summary: requirements from #1872 met, all mechanical claims independently re-verified (contamination test passes with the new rule actually in scope, SKILL.md --check clean, 401/401 lib tests pass), rule text reinforces rather than duplicates/contradicts TOOL_STRATEGY_RULES, verification claims are appropriately hedged and internally consistent with the issue thread, and human sign-off on #1872 is confirmed genuine (3 comments from malibio, explicit 'land as-is' approval). No blockers.
Summary
Follow-up to #1865/PR #1873. That investigation traced the fabricated venue-creation claim (scenario 8d) to a cascade: scenario 8b's
create_schemacall is rejected by validation (atitle_templateplaceholder missing fromfields), and the model — instead of retrying with a correction — asks the user a clarifying question, which the eval harness can't answer. The venue schema is never created, so 8d has nothing valid to act on.This PR adds the missing guidance: a new
SchemaRule,SCHEMA_VALIDATION_ERROR_RETRY, parallel to the existingSCHEMA_ALREADY_EXISTSrule, telling the model that a validation error (not "already exists") names the specific problem and should be fixed and retried in the same turn — not escalated to the user.TOOL_STRATEGY_RULESalready forbids clarifying beforecreate_schema/create_node/update operations; this closes the gap where the model didn't have an explicit alternative to clarifying when a call it just made was rejected.Changes
packages/agent/src/skill_rules.rs: newSCHEMA_VALIDATION_ERROR_RETRYrule, registered inSCHEMA_RULESpackages/agent/src/skill_pipeline.rs: interpolated intoschema_creation_guidance()'s "CREATING A SCHEMA" sectionpackages/agent/src/bin/gen_skill_md.rs: renders the new rule's prose form into the generated blockpackages/skill/SKILL.md: regenerated (cargo run -p nodespace-agent --bin gen_skill_md -- --write),--checkcleanVerification
Live-verified against a purged, isolated
gemma-4-e4b-q4kmdaemon (release build,NODESPACE_HOME-isolated,served_db_pathconfirmed) — not just unit tests, since this is a guidance-prose change:create_schemaerror and retried instead of asking the user or giving up, confirming the guidance is followed. 2 of those were "already exists" (pre-existing rule, unaffected) and completed successfully.Full verification detail and an earlier fabricated-report catch are documented on #1872.
Test plan
cargo test -p nodespace-agent --lib— 401/401 passedcargo run -p nodespace-agent --bin gen_skill_md -- --check— cleanbun 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