Skip to content

fix(kanban): narrow active PR respawn guard - #35593

Open
vmlinuzx wants to merge 1 commit into
NousResearch:mainfrom
vmlinuzx:fix/kanban-pr-respawn-guard
Open

fix(kanban): narrow active PR respawn guard#35593
vmlinuzx wants to merge 1 commit into
NousResearch:mainfrom
vmlinuzx:fix/kanban-pr-respawn-guard

Conversation

@vmlinuzx

Copy link
Copy Markdown

Summary

Fixes the Kanban dispatcher active_pr respawn guard so it only blocks respawn when a recent task comment actually indicates that this task opened/created/submitted a PR.

Before this change, any recent GitHub PR URL in any task comment triggered active_pr. That caused operator-hostile behavior: a worker handoff could cite an upstream/reference PR under upstream_checked, the dashboard Nudge dispatcher button would wake the dispatcher, and the task would still sit in ready because the dispatcher silently skipped it as respawn_guarded: active_pr.

The duplicate-PR guard is still preserved for explicit task-owned PR comments such as:

  • PR created: https://github.com/org/repo/pull/42
  • Opened https://github.com/org/repo/pull/42
  • structured task-owned keys such as created_pr, opened_pr, submitted_pr, or task_pr

But upstream/reference/evidence PR URLs no longer wedge a ready task.

SDD

Included in this PR:

  • DOCS/planning/SDD_kanban_pr_respawn_guard.md

Core diagnosis from the SDD:

The current predicate is too broad. Worker handoffs often include upstream reconnaissance such as related issues or upstream PRs. A comment that merely records an upstream/reference PR is not evidence that the worker opened a task-owned PR.

Resolved Code

Changed hermes_cli/kanban_db.py:

  • Added _RESPAWN_GUARD_TASK_PR_HINT_RE for explicit ownership/opening language.
  • Added _comment_indicates_task_owned_pr(body).
  • Updated check_respawn_guard(...) to return active_pr only when both are true:
    1. the comment contains a GitHub PR URL, and
    2. the comment contains task-owned PR language.

This keeps the guard from treating upstream_checked, related PR, or evidence-only PR links as task-owned PRs.

Tests

Added regression coverage in tests/hermes_cli/test_kanban_db.py:

  • test_respawn_guard_upstream_pr_reference_not_guarded
  • test_respawn_guard_related_pr_reference_not_guarded
  • test_respawn_guard_upstream_pr_url_key_not_guarded
  • test_dispatch_respawn_guard_spawns_with_upstream_pr_reference

Preserved existing positive coverage:

  • test_respawn_guard_active_pr_in_comment
  • test_dispatch_respawn_guard_skips_active_pr

Verification

RED evidence:

  • The upstream/reference PR tests failed before the production change with AssertionError: assert 'active_pr' is None.
  • The dispatcher regression failed before the production change because res.respawn_guarded == [(task_id, 'active_pr')].
  • The pr_url negative test was added after outside-family review and failed before resolving the ambiguous key behavior.

GREEN evidence:

PYTHONPATH=/home/vmlinux/src/hermes-agent-fix-kanban-pr-guard \
  /home/vmlinux/src/hermes-agent/venv/bin/python -m pytest \
  tests/hermes_cli/test_kanban_db.py -q -o 'addopts='
# 209 passed in 7.50s

PYTHONPATH=/home/vmlinux/src/hermes-agent-fix-kanban-pr-guard \
  /home/vmlinux/src/hermes-agent/venv/bin/python -m ruff check \
  hermes_cli/kanban_db.py tests/hermes_cli/test_kanban_db.py
# All checks passed!

git diff --check
# passed

Thunderdome / Dialectical Review

Included review artifacts:

  • DOCS/planning/autocode/B_TEAM_FEEDBACK.md
  • DOCS/planning/autocode/OUTSIDE_FAMILY_SECONDARY_DIALECTIC_REVIEW.md
  • DOCS/planning/autocode/DEEPSEEK_SECONDARY_DIALECTIC_REVIEW.md

Outside-family Claude review verdict: APPROVE.

Claude raised one concrete critique: bare pr_url / pull_request_url keys can be upstream evidence and should not count as task ownership. That critique was resolved in this PR by adding test_respawn_guard_upstream_pr_url_key_not_guarded and removing bare pr_url / pull_request_url from the ownership-hint regex.

DeepSeek/Pi review was attempted but exceeded the 300-second foreground timeout and produced no usable output; the unavailability is recorded in the artifact per the Thunderdome fallback rule.

Related

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins labels May 31, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Review

A well-diagnosed fix for the kanban respawn guard being too broad — treats upstream/reference PR URLs as task-owned PRs, wedging tasks in ready state.

✅ Looks Good

  • Correct diagnosis: SDD clearly identifies the scope creep (bare PR URL match vs PR URL + ownership language).
  • Narrow regex: Explicit ownership/opening keywords required; bare pr_url keys explicitly excluded.
  • Thorough tests: 6 regression tests — positive (task-owned) and negative (upstream/reference) cases, including dispatcher integration.
  • Dialectical review artifacts: SDD, B-Team feedback, outside-family review — process evidence.
  • Claude critique incorporated: pr_url/pull_request_url keys removed from ownership hints per review.

Reviewed by Hermes Agent (cron job)

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved ✅ — Narrow the active PR respawn guard in kanban. Clean, focused fix.


Reviewed by Hermes Agent

@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 identifying a real respawn-guard false positive. Current main still returns active_pr for any recent PR URL at hermes_cli/kanban_db.py:7105-7112.

Problems

  • hermes_cli/kanban_db.py:4685-4688 independently matches ownership language and a PR URL anywhere in the same comment. A handoff saying Opened a PR for investigation; upstream reference: https://github.com/acme/project/pull/42 would still guard even though its only URL is upstream evidence. This does not meet the stated task-owned-PR condition.
  • The change leaves the user guide inconsistent: website/docs/user-guide/features/kanban.md:706 and :927 still document active_pr as any recent PR link.

Suggested changes

  • Correlate ownership language with the particular URL, such as by parsing a structured task-owned field or requiring both signals in one bounded text segment; add a regression for separated ownership wording and an upstream URL.
  • Update both canonical Kanban documentation entries to describe the final predicate.

Current check_respawn_guard has also gained rate-limit and explicit-requeue paths at hermes_cli/kanban_db.py:7039-7103; salvage should preserve those branches. This is an automated hermes-sweeper review.

Comment thread hermes_cli/kanban_db.py
return bool(
body
and _RESPAWN_GUARD_PR_URL_RE.search(body)
and _RESPAWN_GUARD_TASK_PR_HINT_RE.search(body)

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 is a comment-global conjunction, not a relationship between the ownership claim and this URL. A handoff can say Opened a PR for investigation and separately cite an upstream PR URL, which still returns True. Please bind ownership evidence to the matched URL/field and add that mixed-comment regression.

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

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants