"""Score-blind visibility: from which unit did the agent have submission n's result? v2 (v49lib.deliver_index / echo_index) decides delivery partly by checking whether the text shows n's *true* score. For a submission still pending at the cut, that true score is post-cut information, so a coincidental number in the pre-cut text can flip it to "seen" and leak its score (found by v3/audit_counterfactual.py). This rule uses only the text and the submission's id and submit time: - id_state: a single-submission segment (v49 segmentation) with n's id and a terminal state (DONE regex) or a labelled score of any value ("score"/"raw_score": number; for Pumpkin, its result markers), and no running/queued state for n in that segment; - poll_reply: a tool result with no submission ids, answering a lone tool call that polled only n's id, carrying a terminal state or a labelled score of any value. It never reads n's score, status, verifier summary or result time. Assistant echoes are not used. """ import re import v49lib as L ANY_SCORE = re.compile(r'\\?"?(raw_score|score)\\?"?\s*[:=]\s*-?\d+(?:\.\d+)?', re.I) def _delivers(seg, fam): sc = L.SHELL_WRAP_DONE.sub('', seg) if L.RUNNING.search(sc) or L.PLAIN_RUN.search(sc): return False return bool(L.DONE.search(sc) or ANY_SCORE.search(sc) or (fam == 'C' and L.C_RESULT.search(sc))) def deliver_index_blind(n, units, fam, pre, N): nid = n['id'].replace('job_', '') if fam == 'C' else n['id'] segs_by_u, all_ids_by_u = pre['segs_by_u'], pre['all_ids_by_u'] prev_asst_by_u, sib_groups = pre['prev_asst_by_u'], pre['sib_groups'] for ui, u in enumerate(units): if u['kind'] in ('assistant', 'response') or u['t'] < n['t_submit']: continue tx = u['text'] if L.is_sidecar(tx): continue my = [seg for i_s, seg in segs_by_u[ui] if i_s == nid] if my: if any(_delivers(seg, fam) for seg in my): return ui continue if nid in all_ids_by_u[ui]: continue if u['kind'] in ('tool', 'user') and not all_ids_by_u[ui] and ui in prev_asst_by_u \ and not tx.startswith('The following is a '): aui = prev_asst_by_u[ui] if len(sib_groups[aui]) != 1: continue atx = units[aui]['text'] if '