mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-11 03:31:55 +00:00
fix(kanban): accept created_cards linked as child of completing task
Widens _verify_created_cards to also accept ids that are children of the completing task in task_links. Previously we only accepted cards where created_by matched the completing task's assignee, which was too strict for legitimate orchestrator flows: a specifier creates a card (so created_by=specifier, not worker), then a worker picks it up and passes parents=[current_task] to kanban_create. The explicit link proves the relationship and should be trusted. Salvaged from #20022 @LeonSGP43 (full PR superseded by #20232 + this patch; the linked-children relaxation was the portable improvement).
This commit is contained in:
parent
eda326df16
commit
6d302b340e
2 changed files with 63 additions and 10 deletions
|
|
@ -2978,6 +2978,46 @@ def test_complete_with_cross_worker_card_is_rejected(kanban_home):
|
|||
conn.close()
|
||||
|
||||
|
||||
def test_complete_accepts_cross_worker_card_when_linked_as_child(kanban_home):
|
||||
"""A card created by a different principal but explicitly linked as
|
||||
a child of the completing task is accepted — the worker took
|
||||
ownership via ``kanban_create(parents=[current_task])`` or an
|
||||
explicit ``link_tasks`` call, which proves the relationship even
|
||||
when ``created_by`` doesn't match.
|
||||
|
||||
(Relaxation salvaged from #20022 @LeonSGP43 — stricter version
|
||||
would incorrectly reject legitimate orchestrator flows where a
|
||||
specifier creates a card, then a worker picks it up and links it
|
||||
to its own parent task.)
|
||||
"""
|
||||
conn = kb.connect()
|
||||
try:
|
||||
parent = kb.create_task(conn, title="parent", assignee="alice")
|
||||
# Card created by a DIFFERENT principal (not alice, not parent).
|
||||
other = kb.create_task(
|
||||
conn, title="other", assignee="x", created_by="bob",
|
||||
parents=[parent], # explicitly links as child of the completing task
|
||||
)
|
||||
|
||||
ok = kb.complete_task(
|
||||
conn, parent,
|
||||
summary="completed with linked child",
|
||||
created_cards=[other],
|
||||
)
|
||||
assert ok is True
|
||||
# The card should appear in the completed event's verified_cards list.
|
||||
import json as _json
|
||||
row = conn.execute(
|
||||
"SELECT payload FROM task_events "
|
||||
"WHERE task_id=? AND kind='completed' ORDER BY id DESC LIMIT 1",
|
||||
(parent,),
|
||||
).fetchone()
|
||||
payload = _json.loads(row["payload"])
|
||||
assert other in payload.get("verified_cards", [])
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def test_complete_prose_scan_flags_nonexistent_ids(kanban_home):
|
||||
"""Successful completion whose summary references a ``t_<hex>`` id
|
||||
that doesn't resolve emits a ``suspected_hallucinated_references``
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue