Skip to content

fix(kanban): persist pass-loop state on task rows - #63723

Draft
ahmadashfq wants to merge 2 commits into
NousResearch:mainfrom
ahmadashfq:fix/kanban-pass-loop-core-pr-t_e17419f0
Draft

fix(kanban): persist pass-loop state on task rows#63723
ahmadashfq wants to merge 2 commits into
NousResearch:mainfrom
ahmadashfq:fix/kanban-pass-loop-core-pr-t_e17419f0

Conversation

@ahmadashfq

Copy link
Copy Markdown
Contributor

Summary

  • persist PASS-loop state directly on kanban task rows in hermes_cli/kanban_db.py
  • cover the reland with the paired tests/hermes_cli/test_kanban_block_kinds.py and tests/hermes_cli/test_kanban_db.py packet only
  • keep this PR scoped to the canonical PASS-loop core packet and explicitly exclude the mixed Agent Wikis family from quarantined source 935f429d8

Scope / packet boundary

This PR is the governed ahmad-fork reland for the canonical PASS-loop core packet only.

Changed files:

  • hermes_cli/kanban_db.py
  • tests/hermes_cli/test_kanban_block_kinds.py
  • tests/hermes_cli/test_kanban_db.py

Explicitly excluded from this packet:

  • hermes_cli/config.py Agent Wikis hunks
  • tools/agentwiki_routing.py
  • tools/web_tools.py
  • related Agent Wikis tests

Research / governance links

  • Upstream research artifact task: t_871aaa57
    • /Users/alimai/.hermes/audits/t_871aaa57/pass-loop-core-upstream-research-2026-07-13.md
  • Canonical implementation packet task: t_60619ea0
    • /Users/alimai/.hermes/audits/t_60619ea0/pass-loop-core-reland-review-handoff-2026-07-13.md
    • /Users/alimai/.hermes/audits/t_60619ea0/pass-loop-core-reland-review-addendum-2026-07-13.md
  • Registry row task: t_72710819
    • /Users/alimai/.hermes/patches/README.md line 77
    • /Users/alimai/.hermes/patches/hermes-kanban-pass-loop-core-packet-a816df6f3-20260713.patch

Duplicate / prior-art check

Checked before opening:

  • gh pr list --repo NousResearch/hermes-agent --author ahmadashfq --state all --search 'pass_loop_status OR pass loop OR review-required blocked OR completion blocked'
    • found existing Ahmad PR #63589, but it is polluted and not safe as the clean packet reference
    • found precursor #61372, which is adjacent prior art rather than a duplicate of durable PASS-loop persistence
  • gh search prs 'pass_loop_status repo:NousResearch/hermes-agent' --state open
    • found #63589 only
  • gh search issues 'pass_loop_status repo:NousResearch/hermes-agent'
    • no direct duplicate issue returned

This clean PR supersedes the polluted PASS-loop presentation in #63589 for reviewer/governance purposes.

Verification

Targeted packet verification on the clean PR worktree:

python3 -m py_compile hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_block_kinds.py tests/hermes_cli/test_kanban_db.py
pytest -q tests/hermes_cli/test_kanban_block_kinds.py tests/hermes_cli/test_kanban_db.py
python3 scripts/check-windows-footguns.py hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_block_kinds.py tests/hermes_cli/test_kanban_db.py
/Users/alimai/.hermes/hermes-agent/venv/bin/python - <<'PY'
# smoke: create temp kanban DB, write halted PASS-loop state, read it back
PY

Results:

  • targeted pytest: 256 passed in 16.02s
  • Windows footgun scan: No Windows footguns found (3 file(s) scanned).
  • smoke result: {'pass_loop_status': 'halted', 'pass_loop_count': 2, 'reason_code': 'pass-loop-detected'}

Repo-wide validation note:

  • scripts/run_tests.sh was attempted from this clean PR worktree but timed out after 600s with unrelated pre-existing failures outside this packet.
  • representative baseline reruns on a fresh detached origin/main worktree reproduced the same failure families outside this PR scope:
    • tests/agent/test_anthropic_adapter.py
    • tests/test_live_system_guard_self_test.py
    • tests/tools/test_approval.py
    • tests/tools/test_file_tools.py

Platforms tested

  • macOS 26.5.2

Governance note

  • Live ~/.hermes/hermes-agent/main remains clean and unapplied pending review + founder tap.
  • This PR was opened from isolated worktree /Users/alimai/.hermes/kanban/boards/fleet-infra/workspaces/t_6346f7ed/pass-loop-core-pr-open on branch fix/kanban-pass-loop-core-pr-t_e17419f0.
  • The earlier implementation-restage worktree remains /Users/alimai/.hermes/kanban/boards/fleet-infra/workspaces/t_6346f7ed/pass-loop-core-reland on branch reland/pass-loop-t_60619ea0.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have labels Jul 13, 2026
@ahmadashfq
ahmadashfq force-pushed the fix/kanban-pass-loop-core-pr-t_e17419f0 branch from 4405d59 to df27a63 Compare July 14, 2026 13:49

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for isolating the proposed PASS-loop work. The current main implementation already keeps review-required handoffs sticky (hermes_cli/kanban_db.py:3244-3279) and persists block_recurrences, escalating repeated same-kind blocks to triage (hermes_cli/kanban_db.py:4876-4915).

Problems

  • hermes_cli/kanban_db.py:3990-4024 treats every completion_blocked_% event as PASS-loop evidence. On current main, the only such production event is completion_blocked_hallucination (hermes_cli/kanban_db.py:4035), which represents phantom created-card IDs, not an unmerged-branch review loop. The candidate predicate can therefore reroute unrelated failures.
  • The candidate branch changes the established escalation from triage to blocked (hermes_cli/kanban_db.py:5951-6007) without a current-main reproduction showing that the existing sticky-block contract is insufficient. Existing coverage verifies that a review-required task remains blocked across dispatcher ticks (tests/hermes_cli/test_kanban_blocked_sticky.py:56-76).
  • _latest_pass_loop_candidate() is invoked inside write_txn and can run git rev-parse with a 10-second timeout (hermes_cli/kanban_db.py:3945-3977, 5939-5945), extending SQLite writer-lock duration.

Suggested changes

  • Establish an exact, production-generated event/payload for the claimed loop and test that real path; do not infer it from broad event prefixes and comment text.
  • Keep the existing triage contract unless a concrete reproduction warrants a deliberately reviewed policy change.
  • Separate the unrelated delivery-state subsystem from this fix.

This is an automated hermes-sweeper review.

Comment thread hermes_cli/kanban_db.py
"""
SELECT id, kind, payload, created_at
FROM task_events
WHERE task_id = ? AND kind LIKE 'completion_blocked_%'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This prefix accepts completion_blocked_hallucination, which current main emits only for phantom created-card IDs (complete_task at current-main hermes_cli/kanban_db.py:4035). That is not evidence of an unmerged-branch PASS loop; define and query an exact producer/event kind for this signal.

Comment thread hermes_cli/kanban_db.py
if _is_review_required_reason(reason):
pass_loop_task = get_task(conn, task_id)
if pass_loop_task is not None:
pass_loop_candidate = _latest_pass_loop_candidate(conn, pass_loop_task)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This runs inside the surrounding write_txn; the candidate path calls _pass_loop_branch_head_sha(), which executes git rev-parse with a ten-second timeout. Do not hold the SQLite writer transaction while invoking an external process.

Comment thread hermes_cli/kanban_db.py
cur = conn.execute(
"""
UPDATE tasks
SET status = 'blocked',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Current main deliberately routes repeated same-kind blocks to triage to force human decision (hermes_cli/kanban_db.py:4876-4915). Keeping this special case blocked changes that established safety contract; retain triage unless a real current-main reproduction demonstrates the need for a different policy.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 16, 2026
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

Thirteen PRs address or reference #59333/#66909: #59367, #59536, and #59645 implement the requested global kanban.block_recurrence_limit; #52848 is the merged hard-coded foundation, while the remaining diffs concern distinct review, dependency, authorization, cron, PASS-loop, or repeated-failure paths. Contributor discussion identifies #66909 as a duplicate of #59333 and #59367 as the active implementation.

Related pull requests

Duplicates

#59536 and #59645 are later implementations of #59367; #61372 overlaps the review-reblock portion of #58695, while #61366 and #64585 address the same parentless-dependency cause with different terminal states.

Suggested consolidation

Author action: rebase #59367 onto current main while preserving its boolean-rejection tests and validated routing/event behavior; close #59536 and #59645 as duplicates of #59367 despite their keep_open reviews because their visible diffs retain the validation and default-registration defects above, and close #66909 as a duplicate of #59333. Keep #68027 open with its durable-fingerprint, audited-rearm, and automatic-path-guard salvage path; keep #59906, #61366/#64585, and #66632 in separately scoped salvage lanes addressing their recorded reviews, keep #60476 only after re-scoping it away from #59333, narrow #58695 to the review-reblock exemption unless an authorized ordered verdict source is added, retain #61372 only as the closed reference, and have #63723’s author split out a narrowly typed PASS-loop signal after reproducing the current-main gap rather than retaining the wildcard predicate and unsupported routing change.

Cross-PR triage: Reviewed 13 pull requests and 2 issues in this complex. Each diff was read against this issue; Assessment working set: 301 kB of PR diffs, 27 kB of issue/PR text, 17 kB of discussion (19 comments), 10 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants