def test_handle_reply_info_targets_specific_code(): db = FakeDB() dbf = lambda: db cfg = DA.ApprovalConfig(channel="test", collection="Ix", cursor_collection="Cur", cursor_key="t", mention="@here", min_confidence=0.85, id_field="request_id", max_open_announcements=5) briefings = [] cb = DA.ApprovalCallbacks( pending_lister=lambda: [{"request_id": "req0001aaaa"}, {"request_id": "req0002bbbb"}], request_formatter=lambda r: f"REQ {r['request_id']}", apply_fn=lambda interaction, verdict: {"ok": True}, confirm_formatter=lambda interaction, verdict: "CONF", clarify_formatter=lambda reason, awaiting: f"CLARIFY {reason}", briefing_formatter=lambda ix: briefings.append(ix["request_id"]) or "BRIEF", ) DA.run_cycle(cfg, cb, poster=Poster(), message_fetcher=lambda a: [], llm_caller=_boom_llm, db_factory=dbf, now=None) open_ix = DA._open_interactions(cfg, dbf) # noqa: SLF001 — test reads the internal state directly codes = {ix["request_id"]: ix["code"] for ix in open_ix} target_rid = "req0002bbbb" poster = Poster() msgs = [{"id": "60", "content": f"info {codes[target_rid]}"}] res = DA.run_cycle(cfg, cb, poster=poster, message_fetcher=lambda a: msgs, llm_caller=_boom_llm, db_factory=dbf, now=None) > assert res["handled"][0]["request_id"] == target_rid ^^^^^^^^^^^^^^^^^ E IndexError: list index out of range tests/services/test_discord_approval.py:803: IndexError