Harden reviewer gate, edit recovery, and spawn/tool-call robustness#26
Open
AnzoBenjamin wants to merge 11 commits into
Open
Harden reviewer gate, edit recovery, and spawn/tool-call robustness#26AnzoBenjamin wants to merge 11 commits into
AnzoBenjamin wants to merge 11 commits into
Conversation
Extract containsStructuralAuditReceipt into @codebuff/common/util/audit-receipt and rewire both the general-agent handleSteps completion gate and spawn-agent-utils buildRuntimeAgentReceipt gate to the shared helper so the two receipt checks cannot drift; cover the helper with a unit test. - general-agent prompt now routes ripgrep-style search through code-searcher (code_search is a registered runtime tool but intentionally not granted to general-agent) and names the required params.searchQueries. - add a code-searcher searchQueries recovery hint in validateAgentInput so an empty spawn gets an actionable message instead of a bare schema error. - add general-agent audit-loop tests covering the receipt-present break and the retry-exhaustion break. - fix the base2 reviewer-spawn coverage-evidence wording from 'below' to 'above' to match where the list is rendered. All changes pass typecheck and the affected test suites.
Tighten the reviewer gate and edit-application paths so authorization and review coverage cannot be silently bypassed. Skip the validation/reviewer gate in PLAN-only mode, where no source edits exist to attest to. Make co-changed tests first-class reviewable files so reviewer attestation covers them instead of always reporting coverage as missing/uncertain; keep them separately identifiable as coverage evidence. Recapture the review snapshot after validation (validation-first), since hooks can mutate generated or formatted output before review. Preserve valid read authorization on deterministic edit_transaction and str_replace preflight failures, and only require a fresh whole-transaction re-read when a capability is genuinely stale or out of scope, so a real freshness failure cannot be sidestepped by refreshing one path while replaying stale tokens for the rest. Scope the edit-application coordinator's positive-evidence confirmation to paths that actually produced a client change, so a no-op path no longer forces a false rejection. Block replace_range in a transaction once a prior non-range edit has shifted the file's line count, preventing it from splicing the wrong lines while its original-snapshot hash check still passes. Broaden spawn_agents validation diagnostics with canonical recovery hints for the reviewer family, dependency-manager, librarian, and get_build_targets, and harden audit-receipt traversal against deep/cyclic structures. Adds regression tests covering each behavior.
Detect a top-level spawn_agents payload where prompt/params/handoff appear as siblings of the agents array, and return the base spawn_agents guidance before the non-strict schema silently drops the stray key.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Align two base2 reviewer-spawn e2e prompts to include a code-intent keyword so proactive query_index fires as the first yield. Update the rewrite-symbol client-rejection assertion to match the branch's deterministic-rejection semantics (rejection preserves read authorization). Add a base2 test pinning which prompts trigger proactive query_index vs skip to git_status.
… cap Track the shallowest depth each object was visited at (WeakMap instead of WeakSet) so a shared receipt first reached beyond MAX_TRAVERSAL_DEPTH via a deep path is still found through a later shorter path; equal-or-deeper revisits and cycles are still skipped. Adds a regression test.
Fold a stray top-level prompt/params/handoff sibling into a single-agent spawn_agents array when unambiguous (multi-agent and unexpected-sibling cases still fail closed); add a corrected-shape example to the spawn_agents validation hint; emit a concrete copyable code-searcher spawn recovery for ungranted code_search/find_files_matching_content instead of the generic not-granted line (message-only, still fail-closed); and reinforce the base2 spawn guidance with the correct spawn_agents shape. Adds focused tests.
Reproduces the real-world failure where the whole agents value is a JSON string with a stray prompt pair floating as a sibling array element; asserts it fails closed with corrected-shape guidance.
Add a debug log on the single-agent mis-braced spawn_agents auto-repair path, recording only the folded sibling key names and toolCallId so prompt/params/handoff values are never leaked. Thread an optional logger through parseRawToolCall and detectMisbracedSpawnPayload from executeToolCall to enable it. Add a processStream integration test asserting the folded repair reaches the spawn handler: the repaired payload emits a spawn_agents tool_call and produces no error event.
The two git-committer block messages in tool-executor now describe the validation/reviewer gate re-arming on every edit and clearing automatically, framing the block as expected ordering rather than a failure so agents wait one gate cycle instead of retrying in a loop. gitDisciplineSection carries matching wait-and-commit guidance, and the run-agent-step-tools and quality-prompt-snapshot tests pin the new wording so the behavior-changing messages stay covered.
Export isTestCoverageReviewerFinding and mirror it inline in handleSteps so pure coverage blockers spawn test-writer only; mixed or code findings stay on repair-editor. Covered by unit, parity, and base2 integration tests.
Expand gateAwareness for re-arm ownership, targeted validation != gate, commit recovery, and pending-set authority. Align base2/base-deep tool-choice and validation bullets; document control-plane and request-flow gate boundaries. Move deep Phase 6 Final Review before Phase 7 Lessons, polish typos, and assert specialistRouting in snapshots.
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.
Hardens agent-spawn and tool-call validation so common model mistakes fail with actionable guidance or safe auto-repair, routes pure test-coverage reviewer findings to the right specialist, and clarifies the hooks→reviewer gate contract for orchestrators.
Spawn / tool-call hardening
spawn_agentshint with corrected inline exampleget_build_targetsempty-files recoverycontainsStructuralAuditReceiptvia min-depth WeakMap trackingReviewer-gate routing (all-coverage → test-writer)
isTestCoverageReviewerFinding(handleSteps serialization-safe)test-writer(not repair-editor)repair-editornextRequiredActionlabel the active agent correctlyGate / hooks guidance (four clarifications)
run_file_change_hooks(model-hidden, injected) → automated code-reviewer → finalization; wait whenawaiting_validationrun_targeted_validationis NOT the gate: scoped evidence only; does not clear findings or unlockgit-committer(same for basher typechecks)owned_pathspendingGateFilesset is authoritative over conversational memoryTests
agents/__tests__/base2.test.tssuite; gate-reviewer unit + parity; quality-prompt-snapshot topic guardsThis change is