The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): report the registered attachment set in the kanban_complete result
liuhao102464c7da592d43
diff --git a/tests/tools/test_kanban_tools.py b/tests/tools/test_kanban_tools.pyindex cfdd09d1153..b40e5101e54 100644--- a/tests/tools/test_kanban_tools.py+++ b/tests/tools/test_kanban_tools.py@@ -168,6 +168,37 @@ def test_complete_retry_with_empty_created_cards_succeeds(worker_env):conn.close()+def test_complete_reports_registered_attachments(worker_env):+ """#117360: artifact staging is atomic with the completion write, so the+ worker's pre-completion `kanban_attachments` readback is always empty and+ workers narrated "registered at completion: none" even when the rows landed.+ The completion result must report the card's durable attachment set, in the+ same shape the readback tool returns."""+ from hermes_cli import kanban_db as kb+ from hermes_cli import kanban_db_connect as kbc+ from hermes_cli import kanban_db_workspace as kbw+ from tools import kanban_tools as kt++ with kbc.connect() as conn:+ task = kb.get_task(conn, worker_env)+ ws = kbw.resolve_workspace(task)+ kbw.set_workspace_path(conn, worker_env, ws)+ artifact = ws / "corpus.json"+ artifact.write_bytes(b"{}")++ out = kt._handle_complete({+ "summary": "done",+ "artifacts": [str(artifact)],+ })+ d = json.loads(out)+ assert d["ok"] is True, d+ assert [(a["filename"], a["size"], a["uploaded_by"]) for a in d["attachments"]] == [+ ("corpus.json", 2, "kanban_complete")]++ readback = json.loads(kt._handle_attachments({"task_id": worker_env}))+ assert readback["attachments"] == d["attachments"]++def test_request_review_rejects_unknown_reviewer_without_mutation(monkeypatch, worker_env, tmp_path):"""#106163: a non-profile ``reviewer`` (e.g. the literal "reviewer") must berefused with an error the model sees, leaving the task running under thediff --git a/tools/kanban_tools.py b/tools/kanban_tools.pyindex 1727182775b..95415e7d86e 100644--- a/tools/kanban_tools.py+++ b/tools/kanban_tools.py@@ -720,7 +720,14 @@ def _handle_complete(args: dict, **kw) -> str:_check(False, (task.last_failure_error if task else None) orf"could not complete {tid} (unknown id, stale run, or already terminal)")run = kb.latest_run(conn, tid)- return _ok(task_id=tid, run_id=run.id if run else None)+ # Artifact staging is atomic with the completion write, so a worker that+ # read `kanban_attachments` before completing saw an empty list and has+ # no way to observe what its completion just registered (#117360).+ # Report the card's durable attachment set in the result.+ return _ok(task_id=tid, run_id=run.id if run else None,+ attachments=[+ _fields(a, _ATTACHMENT_FIELDS)+ for a in kb.list_attachments(conn, tid)])@_kanban_handler("kanban_block")