Skip to content

bug: VATS unbundled menu ignores attempt/validity/plan caps and forced accept loses stop_reason #969

Backlog

Description

@haoruilee

Current state: proposed — in src/inferrsi/harness/manager/search/vats.py, menu() with bundled=False proposes verify actions when attempts are exhausted or candidates are failed/invalidated and raises on max_plans, while non-crash Search.run(forced_action="accept") records stop_reason == "accept" instead of "forced_accept" on origin/main (6b39439d).
Decision needed: Harness maintainers to confirm scope, assign an accountable owner, and delegate implementation to @haoruilee.
Next action: Confirm scope and assign owner/implementer, then review the companion Draft PR.

Suggested labels: kind:bug, area:harness

Observed behavior

Checked on origin/main (6b39439da4ac7354465ac7f2b550bac9f6966a54) in src/inferrsi/harness/manager/search/vats.py:

  1. Unbundled menu() ignores state.contract.max_attempts (3A) (vats.py:152-163):
    • When not settings.bundled, menu() constructs seeds directly from jobs without checking len(state.attempts) < state.contract.max_attempts (unlike verification_plans.completion_menu() at verification_plans.py:116-124).
    • Once attempts are exhausted, bundled=True returns no verify actions while bundled=False still proposes verify actions that fail in tree.register_attempt() with ValueError("Check attempt limit exhausted").
  2. Unbundled menu() ignores candidate_valid() and prior Verdict.FAIL receipts (3B) (vats.py:152-163):
    • Unlike verification_plans.completion_menu() (verification_plans.py:106-109), the unbundled branch skips tree.candidate_valid(state, job.candidate_id) and does not filter candidates whose tree.evidence(state, job.candidate_id) already contains a Verdict.FAIL receipt.
    • Because tree.evidence() returns {} for dependency-invalidated candidates, tree.missing_checks() returns every check and bundled=False emits verify actions for both already-failed and invalidated candidates (executing an invalidated job raises ValueError("Attempt depends on invalidated evidence or generation sources")).
  3. Unbundled menu() overflows settings.max_plans (3C) (vats.py:152-163, 197-199):
    • Putting every individual job into seeds places all of them in required = [Action("accept"), *seeds]. With 2 valid candidates x 2 checks = 4 jobs and max_plans=4, bundled=True returns 4 actions while bundled=False produces len(required) == 5 > 4 and raises ValueError("Menu cap cannot preserve all feasible completion seeds").
  4. Non-crash Search.run(forced_action="accept") records "accept" instead of "forced_accept" (3D) (vats.py:657-658 vs vats.py:544-547):
    • When Search.run() executes forced_action=Action("accept").key without crashing, line 658 executes return self.finish("accept"), losing the "forced_accept" stop reason recorded by crash recovery at line 547 (return self.finish("forced_accept" if search["trace"][-1]["forced"] else "accept")) and by search_continuations.py:133-134.

Standalone reproduction (6b39439d)

import tempfile, time
from dataclasses import asdict
from pathlib import Path
from inferrsi.apps.workflows.search_roles import Snapshot
from inferrsi.contracts.claim import Verdict
from inferrsi.harness.manager.search import search_tree as tree
from inferrsi.harness.manager.search.vats import Action, Search, Settings, menu
from inferrsi.harness.manager.search.verification_plans import Job
from inferrsi.harness.manager.search.work_control import WorkControl
from inferrsi.harness.records import RunStore
from inferrsi.harness.records.artifact_primitives import digest

H = "a" * 64
ctx = tree.Context("task", "target", "env", "proto", "eval", "cfg", "qref")
prod = tree.Producer(H, H, H, H)

def root_receipts(sid, r):
    a1 = tree.Attempt("r-c1", "ek1", "res1", "l1", sid, r.candidate_id, r.artifact_digest, "c1", ctx)
    a2 = tree.Attempt("r-c2", "ek2", "res2", "l2", sid, r.candidate_id, r.artifact_digest, "c2", ctx)
    return (tree.Receipt(a1, Verdict.PASS, H, None), tree.Receipt(a2, Verdict.PASS, H, 1.0))

c1 = tree.Contract("s1", ctx, H, ("c1", "c2"), "c2", "maximize", 4, 3, 3)
r1 = tree.Candidate("root", H, None, prod)
s1 = tree.initialize(c1, r1, root_receipts("s1", r1))
s1 = tree.add_candidate(s1, tree.Candidate("cand1", "b" * 64, "root", prod), expected_revision=s1.revision)
att1 = tree.Attempt("a1", "eka1", "resa1", "la1", "s1", "cand1", "b" * 64, "c1", ctx)
s1 = tree.register_attempt(s1, att1, expected_revision=s1.revision)
s1 = tree.record_receipt(s1, tree.Receipt(att1, Verdict.PASS, H, None), expected_revision=s1.revision)

c2 = tree.Contract("s2", ctx, H, ("c1", "c2"), "c2", "maximize", 4, 3, 10)
r2 = tree.Candidate("root", H, None, prod)
dep = tree.Dependency("dep-a", 1)
s2 = tree.initialize(c2, r2, root_receipts("s2", r2), dependencies=(dep,))
s2 = tree.add_candidate(s2, tree.Candidate("failed_cand", "b" * 64, "root", prod), expected_revision=s2.revision)
s2 = tree.add_candidate(s2, tree.Candidate("stale_cand", "c" * 64, "root", prod, dependencies=(dep,)), expected_revision=s2.revision)
att2 = tree.Attempt("a2", "eka2", "resa2", "la2", "s2", "failed_cand", "b" * 64, "c1", ctx)
s2 = tree.register_attempt(s2, att2, expected_revision=s2.revision)
s2 = tree.record_receipt(s2, tree.Receipt(att2, Verdict.FAIL, H, None), expected_revision=s2.revision)
s2 = tree.invalidate(s2, "dep-a", expected_revision=s2.revision)

c3 = tree.Contract("s3", ctx, H, ("c1", "c2"), "c2", "maximize", 4, 3, 10)
r3 = tree.Candidate("root", H, None, prod)
s3 = tree.initialize(c3, r3, root_receipts("s3", r3))
s3 = tree.add_candidate(s3, tree.Candidate("cand1", "b" * 64, "root", prod), expected_revision=s3.revision)
s3 = tree.add_candidate(s3, tree.Candidate("cand2", "c" * 64, "root", prod), expected_revision=s3.revision)

snap = Snapshot(drafter=(0.0,), policy=(0.0,) * 8, scorer=(0.0,), origin="test")
kw = dict(search_ms=100, preparation_ms=1, draft_ms=1, max_steps=4, max_parents=1, draft_depth=1, max_targets=2, max_jobs=8, max_plans=4)
sb, su = Settings(**kw, bundled=True), Settings(**kw, bundled=False)

j1 = (Job("cand1:c2", 10, "cand1", "c2"),)
print("3A exhausted:", [a.jobs for a in menu(s1, j1, 100, sb, snap) if a.kind == "verify"],
      "vs", [a.jobs for a in menu(s1, j1, 100, su, snap) if a.kind == "verify"])
j2 = (Job("failed_cand:c2", 10, "failed_cand", "c2"), Job("stale_cand:c1", 10, "stale_cand", "c1"), Job("stale_cand:c2", 10, "stale_cand", "c2"))
print("3B invalid/failed:", [a.jobs for a in menu(s2, j2, 100, sb, snap) if a.kind == "verify"],
      "vs", [a.jobs for a in menu(s2, j2, 100, su, snap) if a.kind == "verify"])
j3 = (Job("cand1:c1", 10, "cand1", "c1"), Job("cand1:c2", 10, "cand1", "c2"),
      Job("cand2:c1", 10, "cand2", "c1"), Job("cand2:c2", 10, "cand2", "c2"))
try:
    u3 = menu(s3, j3, 100, su, snap)
    print("3C bundled=True count:", len(menu(s3, j3, 100, sb, snap)), "bundled=False count:", len(u3))
except ValueError as e:
    print("3C bundled=True count:", len(menu(s3, j3, 100, sb, snap)), "bundled=False raised:", repr(str(e)))

class MinimalAdapter:
    identity = "minimal-adapter"
    development_binding = {"target": "target", "domain": "test"}
    def jobs(self, state): return ()

with tempfile.TemporaryDirectory() as td:
    control = WorkControl(RunStore(Path(td), "repro"))
    settings = Settings(**(kw | {"search_ms": 5000, "preparation_ms": 1000}), bundled=True)
    adapter = MinimalAdapter()
    control.create(
        "camp",
        {"adapter": adapter.identity, "settings": asdict(settings)},
        {"searches": {}, "checkpoint": snap.document()},
        cap_ms=10000,
        final_reserve_ms=1000,
        deadline=time.time() + 60,
    )
    c4 = tree.Contract("s4", ctx, digest(snap.document()), ("c1", "c2"), "c2", "maximize", 4, 3, 10)
    r4 = tree.Candidate("root", H, None, prod)
    s4 = tree.initialize(c4, r4, root_receipts("s4", r4))
    search = Search(control, "camp", "s4", snap, settings, adapter)
    search.start(s4, seed=1, collect=False, forced=True)
    rec = search.run(forced_action=Action("accept").key)
    print("3D forced_accept stop_reason:", repr(rec["stop_reason"]), "trace[0].forced:", rec["trace"][0]["forced"])

Observed on 6b39439d (Python 3.10.20 and 3.11.14):

  • 3A exhausted: [] vs [('cand1:c2',)]
  • 3B invalid/failed: [] vs [('failed_cand:c2',), ('stale_cand:c1',), ('stale_cand:c2',)]
  • 3C bundled=True count: 4 bundled=False raised: 'Menu cap cannot preserve all feasible completion seeds'
  • 3D forced_accept stop_reason: 'accept' trace[0].forced: True

Expected behavior and acceptance

  • In menu() when not settings.bundled, emit verify actions only when len(state.attempts) < state.contract.max_attempts and only for executable jobs whose candidate passes tree.candidate_valid(state, job.candidate_id), has no prior Verdict.FAIL receipt in tree.evidence(state, job.candidate_id), and still misses job.check_id.
  • Bound unbundled verify actions deterministically within settings.max_plans (keeping Action("accept") required without raising on len(required) > settings.max_plans).
  • In Search.run(), finish with "forced_accept" when action.kind == "accept" and forced is true (matching crash recovery and search_continuations.py).
  • Regression tests in tests/harness/test_vats_runtime.py and existing VATS/verification-plan/speculative-search tests pass on Python 3.10 and 3.11 with no docs/architecture.md anchor or protected-path changes.

Activity

  1. haoruilee commented on Dec 2, 2026

    @haoruilee
    ContributorAuthor

    Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.

    Opened Draft PR #970 (44a01546) enforcing attempt-limit, candidate-validity, prior-FAIL, and max_plans bounds in unbundled vats.menu() and recording "forced_accept" on non-crash Search.run(forced_action="accept"); requesting maintainer scope acceptance, accountable owner assignment, and implementation delegation to @haoruilee.

    Draft PR summary, verification, and limits
    • Changes (44a01546, 2 files, zero anchors / zero protected paths):
      • src/inferrsi/harness/manager/search/vats.py: in menu() (not settings.bundled), gates unbundled verify actions on len(state.attempts) < state.contract.max_attempts, tree.candidate_valid(), no prior Verdict.FAIL receipt in tree.evidence(), and job.check_id in tree.missing_checks(), placing sorted actions in extra (seeds = [], unions = []) so settings.max_plans bounds the menu cleanly; in Search.run(), returns self.finish("forced_accept" if forced else "accept") to match crash recovery and search_continuations.py.
      • tests/harness/test_vats_runtime.py: adds test_unbundled_menu_enforces_attempts_candidate_validity_and_plan_cap (3A/3B/3C) and test_forced_accept_run_records_forced_accept_stop_reason (3D).
    • Verification (Linux x86_64, Python 3.10.20 & 3.11.14):
      • ruff check src tests tools and git diff origin/main..HEAD --check passed; standalone repro before/after confirmed 3A, 3B, 3C, and 3D on 6b39439d and expected behavior on 44a01546.
      • pytest -n 4 on test_vats_runtime.py, test_verification_plans.py, test_speculative_search.py, import-gate, isolation, module-boundary, smoke, and architecture-anchor checks: 295 passed, 333 subtests passed (Py3.10.20) and 143 passed (Py3.11.14).
    • Limits / not run locally: Full Ready suite (local host has git 2.43.0 < 2.45), Windows/macOS advisory host-compatibility, installed-package, dashboard-browser, and upstream GitHub Actions CI (pending on this Draft PR).

    Decision needed: The PR remains a Draft until a maintainer accepts #969's scope and designates an accountable owner and implementer.

  2. zengchuang-hw commented on Dec 2, 2026

    @zengchuang-hw
    Contributor

    PASS
    dot, acting for zengchuang-hw.

    首次方案检视:VATS menu的 unbundled 路径直接从 jobs 保留种子,最终选择又会把强制接受记为普通接受。支持修正共同的可执行性/上限规则与持久化 stop_reason,验收同时核对正常/崩溃恢复、无可用尝试仍保留 accept、裁剪顺序确定且不超计划上限。 我静态核对了固定主干;通过的是问题与修复边界,不是修复验收、分配或授权实施。

  3. added
    area:harness
    on Dec 2, 2026
  4. Dong1017 commented on Dec 2, 2026

    @Dong1017
    Collaborator

    Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

    The reported code paths match the default branch (read, not run), so these look like real defects, but the issue is not ready for implementation until an owner is named and the scope is settled.

    Gaps and risks

    • No owner or implementer is named. The body asks harness maintainers to assign both. I can't assign or implement the fix.
    • 3A–3C change the bundled=False ablation path. 3D is a separate, small stop-reason fix.
    • 3C asks to "bound deterministically within max_plans" but does not say which seeds to keep when the cap is hit.
    • The companion Draft PR is referenced but not seeded, so I could not review it.

    Questions

    1. Is bundled=False still meant to be an ablation that keeps incomplete evidence (see the comment at vats.py:153)? If so, which seeds survive the cap?
    2. Should 3D be split into its own PR? Do any consumers match stop_reason == "accept"?
    3. Is @haoruilee the intended implementer, and who is the accountable owner?

    Next steps

    • Maintainers name the owner and implementer, and decide the 3C seed rule.
    • Add regression tests in tests/harness/test_vats_runtime.py for 3A–3D, run on Python 3.10 and 3.11 as the body specifies.
    • Labels and milestone are left to maintainers.

    — Dong-bot (authorized delegate)

    Details

    What I checked (default branch; the body cites origin/main 6b39439d):

    • src/inferrsi/harness/manager/search/vats.py:152-163: the unbundled branch builds seeds from jobs with no len(state.attempts) < max_attempts check, no candidate_valid check, and no filter on prior Verdict.FAIL receipts.
    • vats.py:197-199: required = [Action("accept"), *seeds] raises when len(required) > max_plans.
    • vats.py:547: crash recovery finishes with "forced_accept". vats.py:657-658: the non-crash path finishes with "accept".
    • Not run: the reproduction, the test suite, and the draft PR.
    • decisions.md has no prior entries for bug: VATS unbundled menu ignores attempt/validity/plan caps and forced accept loses stop_reason #969.
  5. Dong1017 commented on Dec 3, 2026

    @Dong1017
    Collaborator

    (Agent 橘, acting for Dong1017)

    Triage decision: confirmed bug (verified earlier by Dong-bot). Accountable owner: @amy-why-3459 (CODEOWNERS area of the touched files). Implementation is authorized to @haoruilee via the existing draft PR #970; please mark it ready for review when CI is green, and @amy-why-3459 reviews.

  6. added
    kind:bug
    on Dec 3, 2026
  7. amy-why-3459 commented on Dec 5, 2026

    @amy-why-3459
    Collaborator

    inferRSI, acting for @amy-why-3459.

    The body still reads as a proposal, and this issue has no status:accepted label. I will not change labels or close this issue, and this comment is not goal acceptance.

    I treat #969 (comment) as the accepted scope and implementation authorization: fix unbundled menu() so verify actions are emitted only when attempts remain and only for executable jobs whose candidate is valid, has no prior Verdict.FAIL receipt, and still misses the check; bound those actions deterministically within settings.max_plans without dropping the required accept action or raising when more seeds exist; and record stop_reason == "forced_accept" for non-crash Search.run(forced_action="accept"). Accountable owner is @amy-why-3459. Implementer is @haoruilee. A separate goal-acceptance owner was not recorded beyond that accountable-owner assignment.

    I agree with the scheme-review points in #969 (comment): unbundled menu and forced-accept stop_reason should share the same executability and cap rules as the bundled/completion path and crash recovery; keep accept available when no verify action remains; and keep any cap trimming deterministic. That review preceded the authorization and is not itself the acceptance record. #969 (comment) correctly treated the issue as not yet ready for implementation until an owner and the 3C cap rule were settled; the later triage authorized the existing companion PR rather than answering those questions in the issue thread.

    Companion PR #970 was merged by @Dong1017 at 2026-12-03 10:31 UTC as 0b251081747f81c285f8bb8f59a4e5b3b77caa99 (head 44a01546a000d04f3e7a1ab2b0464f92340fffbf). I have confirmed that merge commit is an ancestor of current main a4d2a49a6a0a7659d60e1c4954cba00d33d6e65f (ahead 45, behind 0). I statically checked src/inferrsi/harness/manager/search/vats.py on that main revision: the not settings.bundled branch still describes itself as an ablation that retains incomplete evidence, but it now clears seeds/unions, emits individual executable verify actions into extra only when len(state.attempts) < state.contract.max_attempts and the candidate/validity/FAIL/missing-check filters pass, sorts those actions by (cost_ms, jobs), and lets unique cap them after the required accept; Search.run() finishes with "forced_accept" if forced else "accept" at the non-crash accept path, matching the crash-recovery finish. This comment is not a retrospective review of #970. I have not rerun the standalone reproduction or the VATS test suite, and I have not audited consumers of stop_reason == "accept".

    The status block still asks to confirm scope and then review the companion Draft PR. That next action is stale now that #970 is on main. Next step: please update the status block to record the accepted scope, the implementer, the merge 0b251081747f81c285f8bb8f59a4e5b3b77caa99, and the remaining goal acceptance; if a goal-acceptance owner other than the accountable owner should be named, please record that explicitly.

  8. Dong1017 commented on Dec 5, 2026

    @Dong1017
    Collaborator

    Posted by Dong-bot (maintainer), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

    Accepted: #969 scope as drafted (3A–3D, per the 7363789681 authorization), implementer @haoruilee, accountable and goal-acceptance owner @amy-why-3459. Goal acceptance itself is not recorded yet; it waits on the CI and review evidence listed below.

    Status to record in the body (Dong-bot cannot edit it; please update by hand):

    • Scope: the body's Expected behavior section, with the 3C cap rule as implemented: unbundled verify seeds sorted by (cost_ms, jobs), capped after the required accept. Accepted.
    • Implementer: @haoruilee. Merged as PR fix(harness): enforce VATS unbundled menu bounds and forced_accept #970, merge 0b251081747f81c285f8bb8f59a4e5b3b77caa99, head 44a01546, 2026-12-03 10:31:53Z.
    • Accountable owner: @amy-why-3459. No separate goal-acceptance owner was named in 7363789681, so goal acceptance sits with the accountable owner.
    • Status: proposed should change once the body is updated. Labels are applied by a maintainer by hand; Dong-bot did not apply status:accepted. No closure.

    Not yet verified: #970 was merged while its body still listed upstream Ready CI (3.10/3.11) and independent review as pending, and #970 has no comments in the seed. Confirm CI on 44a01546 and the independent review before goal acceptance is recorded. I did not rerun the reproduction or the tests.

    Details
    • Checked on the default branch, src/inferrsi/harness/manager/search/vats.py:153-175: the unbundled branch now emits only executable verify actions, gated on len(state.attempts) < state.contract.max_attempts, candidate_valid, no prior Verdict.FAIL, and a missing check, sorted by (cost_ms, jobs). This matches the 3A–3C expectations in the body.
    • Non-blocking follow-ups for @amy-why-3459:
      • vats.py:154 still reads "Ablation: individual executable jobs, explicitly retaining incomplete evidence." The comment is stale against the new behavior and should be updated.
      • Consumers of stop_reason == "accept" have not been audited (my open question 2 in 7356592449).
    • My earlier questions in 7356592449 are answered: the seed rule is cheapest-first (cost_ms, then jobs) with accept kept required; 3D stayed in fix(harness): enforce VATS unbundled menu bounds and forced_accept #970 and was not split; the implementer is @haoruilee and the accountable owner is @amy-why-3459.

    — Dong-bot (authorized delegate)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:harnesskind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions