--- id: DOC_task_2_heading_style_normalize name: 修 LibreOffice 15 个混合样式标题 (8 H1 + 2 H2 + 5 fake) category: DOC timeout_seconds: 1800 --- ## Prompt `/tmp_workspace/report.odt` contains **15 visually identical** section headings (all bold 16pt). But there are actually 4 different underlying styles: - **8** are real `Heading 1` (outline level 1) - **3** are `Default Paragraph Style` + manual bold + manual 16pt - **2** are `Heading 2` (outline level 2) - **2** use some custom paragraph style Task: **Find the 7 headings that are not Heading 1 and change them all to Heading 1**; then insert a table of contents (should have 15 entries) + export to PDF. Deliverables: - `/tmp_workspace/results/report.odt` — the fixed document; all 15 headings should be Heading 1. - `/tmp_workspace/results/report.pdf` — PDF exported from the document; the first page or TOC page should show the full 15-entry table of contents. - `/tmp_workspace/results/proof.png` — an evidence screenshot, file ≥ 20KB, resolution ≥ 1024×600; must demonstrate your process of inspecting/fixing styles. - `/tmp_workspace/results/report.md`, **must** contain: - `wrong_titles: ` — order doesn't matter; **over-reporting or under-reporting both lose points** - `tool_used: ` (must be strictly from the whitelist: `libreoffice` / `lowriter` / `writer` / `navigator` / `style_dropdown`; any other value scores 0) - A description ≥ 80 characters describing **how you distinguished** real vs. fake headings. ## Expected Behavior 参考解题流程 (设计者参考, 不发给 agent): 1. `lowriter /tmp_workspace/report.odt &` 打开。 2. 按 **F5** 打开 Navigator 看 Headings: 你会看到只有 8 条 H1 + 2 条 H2, 共 10 条 outline entries。文档里有 15 个粗体标题 → 5 个完全不在 Navigator 里 (就是 fake_p + fake_chapter)。 3. 把光标点到每个**没出现在 Navigator** 里的标题, 以及 Navigator 里被标为 H2 的标题。左上角 Style 下拉框会显示一个不是 "Heading 1" 的样式名 → 全改成 "Heading 1"。 4. F5 再看一次, Navigator 现在应该是 15 条 H1。 5. `Ctrl+S` 保存。 6. `Insert → Table of Contents and Index → Table of Contents...` → OK。生成的目录应该有 **15 项**。 7. `File → Export As → Export as PDF...` → 保存到 `/tmp_workspace/results/report.pdf`。 8. `cp /tmp_workspace/report.odt /tmp_workspace/results/report.odt` 9. 截图 `/tmp_workspace/results/proof.png` — Navigator 面板显示 15 条 Heading 1。 10. 写 `/tmp_workspace/results/report.md` 含 `wrong_titles` (恰好 7 个标题名) / `tool_used` (白名单内) / ≥ 80 字符说明 (同时提到 Navigator 与 Style)。 判分要点速览: 1. lowriter report.odt + F5 → 看到 8 H1 + 2 H2, 5 个标题完全不在大纲里。 2. 找 5 个 fake (Results, Conclusion, Future Work, Funding, Glossary) + 2 个 H2 (Appendix B: Code, Index) = 7 个 wrong。 3. 都改成 Heading 1, 保存。 4. 插 TOC, 导出 PDF。 5. 截图 + 写 report.md。 ## Source - EyesOn-Bench Seed v12 改编 (5→15 标题, 加 H2 / FakeChapter decoy, 反 unzip / UNO 作弊) ## Grading Criteria - [ ] 1. results/report.odt 存在 - [ ] 2. 修复后 report.odt 中 outline-level=1 的 恰好出现 15 次 (>=14 仅得半分) - [ ] 3. results/report.pdf 存在 (>=10KB),pdftotext 能找到全部 15 个章节标题 (>=14 半分) - [ ] 4. report.md 中 wrong_titles 含 7/7 GT 名字 (>=6 半分,<6 不及格) - [ ] 5. tool_used 必须是白名单内取值 + 解释段 ≥ 80 字符 + 同时提到 Navigator 与 样式下拉/Style 之一 - [ ] 6. proof.png 存在 ≥ 20 KB 且分辨率 ≥ 1024×600 - [ ] 7. (audit) 没有 import uno / unzip .odt / 直接编辑 content.xml 作弊 - [ ] 8. (HARD GATE) heading_count!=15 → 总分封顶 0.40;wrong_titles<6 → 封顶 0.45;PDF 缺失 → 封顶 0.50 - [ ] 9. (VLM HARD GATE) proof.png 真显示 Navigator 15 条同级 H1;无 VLM 时总分封顶 0.60 ## Automated Checks ```python def grade(workspace_path=None, **kwargs) -> dict: import re, zipfile, subprocess from pathlib import Path try: from PIL import Image except Exception: Image = None try: from _judge_helper import vlm_score_rubric, audit_chat_jsonl_for_banned except Exception: vlm_score_rubric = None audit_chat_jsonl_for_banned = None ws = Path(workspace_path) if workspace_path else Path("/tmp_workspace") rd = ws / "results" gt_dir = ws.parent / "gt" if (ws.parent / "gt").exists() else Path("/tmp_workspace/gt") scores = {} rep = rd / "report.md" text = rep.read_text(encoding="utf-8", errors="ignore") if rep.exists() else "" text_l = text.lower() scores["report_exists"] = 1.0 if text.strip() else 0.0 # 1+2. odt + heading count (exact 15 required for full credit) odt = rd / "report.odt" scores["odt_exists"] = 1.0 if odt.exists() else 0.0 scores["heading_count_15"] = 0.0 h1_count = 0 if odt.exists(): try: with zipfile.ZipFile(odt) as z: content = z.read("content.xml").decode("utf-8", errors="ignore") h1_count = len(re.findall(r']*outline-level="1"', content)) scores["heading_count"] = h1_count if h1_count == 15: scores["heading_count_15"] = 1.0 elif h1_count == 14: scores["heading_count_15"] = 0.5 elif h1_count >= 12: scores["heading_count_15"] = 0.25 except Exception as e: scores["odt_xml_err"] = str(e)[:120] # 3. PDF + sections (require all 15 for full credit) pdf = rd / "report.pdf" scores["pdf_exists"] = 1.0 if (pdf.exists() and pdf.stat().st_size >= 10*1024) else 0.0 scores["pdf_has_15_sections"] = 0.0 if pdf.exists(): try: out = subprocess.run(["pdftotext", "-layout", str(pdf), "-"], capture_output=True, text=True, timeout=30).stdout sections = ["Background","Methodology","Results","Discussion","Conclusion", "Appendix A","Appendix B","Limitations","Future Work", "Acknowledgments","Funding","References","Glossary","Index","Author Bios"] present = sum(1 for s in sections if s in out) scores["pdf_section_count"] = present if present == 15: scores["pdf_has_15_sections"] = 1.0 elif present >= 14: scores["pdf_has_15_sections"] = 0.5 elif present >= 10: scores["pdf_has_15_sections"] = 0.25 except Exception as e: scores["pdftotext_err"] = str(e)[:80] # 4. wrong_titles match (full credit only at 7/7) expected_set = set() if (gt_dir / "expected_wrong_titles.txt").exists(): expected_set = {t.strip() for t in (gt_dir / "expected_wrong_titles.txt").read_text().split(",") if t.strip()} m = re.search(r"wrong_titles\s*[:=]\s*([^\n]+)", text) scores["wrong_titles_match"] = 0.0 matched_titles = 0 if m and expected_set: reported = {t.strip().rstrip(".,;:") for t in m.group(1).split(",") if t.strip()} matched_titles = len(expected_set & reported) # penalize over-reporting (false positives) too false_positives = len(reported - expected_set) scores["wrong_titles_matched"] = matched_titles scores["wrong_titles_false_positives"] = false_positives if matched_titles == 7 and false_positives == 0: scores["wrong_titles_match"] = 1.0 elif matched_titles >= 6 and false_positives <= 1: scores["wrong_titles_match"] = 0.6 elif matched_titles >= 4: scores["wrong_titles_match"] = matched_titles / 14.0 # capped 0.5 # 5. tool_used (whitelist) + explanation + GUI mention (BOTH terms) tool_whitelist = {"libreoffice", "lowriter", "writer", "navigator", "style_dropdown"} tm = re.search(r"tool_used\s*[:=]\s*([A-Za-z_][\w_]*)", text) scores["tool_field"] = 1.0 if (tm and tm.group(1).strip().lower() in tool_whitelist) else 0.0 explain = "\n".join( ln for ln in text.splitlines() if not re.match(r"\s*(wrong_titles|tool_used)\s*[:=]", ln, re.IGNORECASE) ).strip() scores["explanation_len"] = 1.0 if len(explain) >= 80 else (len(explain) / 80.0) has_navigator = ("navigator" in text_l) or ("f5" in text_l) has_style = ("style dropdown" in text_l) or ("样式下拉" in text) or ("style box" in text_l) or ("paragraph style" in text_l) if has_navigator and has_style: scores["mentions_gui"] = 1.0 elif has_navigator or has_style: scores["mentions_gui"] = 0.5 else: scores["mentions_gui"] = 0.0 # 6. proof.png — size + resolution pp = rd / "proof.png" scores["proof_png"] = 0.0 proof_ok = False if pp.exists() and pp.stat().st_size >= 20 * 1024: if Image is not None: try: with Image.open(pp) as im: w, h = im.size scores["proof_resolution"] = f"{w}x{h}" if w >= 1024 and h >= 600: scores["proof_png"] = 1.0 proof_ok = True elif w >= 800 and h >= 480: scores["proof_png"] = 0.5 except Exception as e: scores["proof_img_err"] = str(e)[:80] else: scores["proof_png"] = 0.5 # cannot verify resolution without PIL # 7. audit (extended banned list) audit_cap = None if audit_chat_jsonl_for_banned: a = audit_chat_jsonl_for_banned([ "import uno", "python3-uno", "unohelper", "uno:socket", "StarOffice.ServiceManager", "unzip /tmp_workspace/report.odt", "unzip report.odt", "zipfile.ZipFile", "/dev/null || true openclaw config unset agents.defaults.imageModel >/dev/null 2>&1 || true openclaw config set agents.defaults.sandbox.imageModel.primary "" >/dev/null 2>&1 || true ```