fix(agent): preserve tool failure truth during locale repair - #365
Merged
Conversation
added 4 commits
July 28, 2026 11:34
PR description incompletePlease fill in all required sections before this PR can be reviewed. Required sections: Description, Related Issue, Type of Change, Checklist, RED Test Proof. For code changes in See CONTRIBUTING.md for the full contribution bar. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Investigate the 28 July 2026 Telegram fleet-report incident end to end, identify every root cause across logs, current code, deployment drift, the Ituran integration, and operator workspace policy; fix all demonstrated generic runtime defects without adding fleet-specific assumptions to the engine; validate the changes; deploy the resulting Comis build to comis-moshe; update the deployment's integration/timeouts and workspace policy where the evidence requires it; restart safely; and leave Moshe a truthful, attachment-verifiable retest path. Preserve Result/error/security/logging contracts, RED-to-GREEN history, and do not add Co-Authored-By trailers.
What Changed
Risk Assessment
✅ Low: The revised change is well-bounded: it carries content-free route identities at the bridge, enforces ordered exact-operation recovery through one shared classifier, and preserves locale diagnostics without reintroducing the incident path.
Testing
Diff and intent inspection, focused agent regressions, prompt-runner egress integration, and a three-scenario product transcript all passed. Initial Vitest-filter and CJS/ESM harness setup errors were corrected without source changes. Live Telegram deployment was not exercised because deployment is outside this assigned local-test phase.
Evidence: Fleet-report delivery truthfulness transcript
Three delivery scenarios passed: unrelated send and different-target attachment success preserved the truthful failure reply; exact attachment retry permitted locale repair. SHA-256: ca869161963aea464bbcf33bf16a110ba1ce79319e28bb9cf9085a100a6fa9cbPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
packages/agent/src/executor/prompt-runner/response-locale-enforcement.ts:234- The intent requires “fix all demonstrated generic runtime defects” and a “truthful, attachment-verifiable retest path,” but recovery is collapsed to tool name. Becausemessagemultiplexes send/reply/attach and targets, a failed report attachment followed by any successfulmessagecall—or even success before failure—makesunrecoveredToolCountzero and re-enables the truth-reversing repair. Choose either conservative blocking after any tool failure or invocation/action/route-level recovery evidence at the bridge and one authoritative shared classifier; this name-only gate is not durable.packages/agent/src/executor/prompt-runner/response-locale-enforcement.ts:241- The failure gate runs before locale evaluation. Since prompt assembly always supplies a policy, failed-tool turns log “repair skipped” even when enforcement is disabled; for a real enforced mismatch, the documented content-freelocaleQualityFindingis never recorded. Evaluate first, return silently when there is no mismatch, and record the finding before skipping model repair.🔧 Fix: fix route-aware tool recovery during locale enforcement
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
git status --short --branch; inspectedaf35aa9e..6d7ab7bediff and commit historyRevieweddocs/developer-guide/generic-agent-architecture.mdagainst the runtime changepnpm exec vitest run --project packages/agent …(setup retry: invalid project filter)pnpm --dir packages/agent exec vitest run src/bridge/tool-failure-recovery.test.ts src/bridge/pi-event-bridge.test.ts src/executor/executor-post-execution.test.ts src/executor/prompt-runner/response-locale-enforcement.test.tspnpm --dir packages/agent exec vitest run src/executor/prompt-runner/output-escalation.test.tsRan an inline Node/TypeScript harness importingapplyResponseLocaleEnforcementandbuildToolRecoveryIdentityacross three delivery scenarios; two initial CJS/ESM harness setup attempts were correctedParsed and validated the generated evidence JSON, then recorded its SHA-256 digestInspected RED/GREEN commit ordering and checked target commit messages for forbiddenCo-Authored-By:trailersgit status --short --untracked-files=allconfirmed the worktree remained clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.