metadata
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: <comma-separated list of exactly 7 heading names>— order doesn't matter; over-reporting or under-reporting both lose pointstool_used: <name>(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):
lowriter /tmp_workspace/report.odt &打开。- 按 F5 打开 Navigator 看 Headings: 你会看到只有 8 条 H1 + 2 条 H2, 共 10 条 outline entries。文档里有 15 个粗体标题 → 5 个完全不在 Navigator 里 (就是 fake_p + fake_chapter)。
- 把光标点到每个没出现在 Navigator 里的标题, 以及 Navigator 里被标为 H2 的标题。左上角 Style 下拉框会显示一个不是 "Heading 1" 的样式名 → 全改成 "Heading 1"。
- F5 再看一次, Navigator 现在应该是 15 条 H1。
Ctrl+S保存。Insert → Table of Contents and Index → Table of Contents...→ OK。生成的目录应该有 15 项。File → Export As → Export as PDF...→ 保存到/tmp_workspace/results/report.pdf。cp /tmp_workspace/report.odt /tmp_workspace/results/report.odt- 截图
/tmp_workspace/results/proof.png— Navigator 面板显示 15 条 Heading 1。 - 写
/tmp_workspace/results/report.md含wrong_titles(恰好 7 个标题名) /tool_used(白名单内) / ≥ 80 字符说明 (同时提到 Navigator 与 Style)。
判分要点速览:
- lowriter report.odt + F5 → 看到 8 H1 + 2 H2, 5 个标题完全不在大纲里。
- 找 5 个 fake (Results, Conclusion, Future Work, Funding, Glossary) + 2 个 H2 (Appendix B: Code, Index) = 7 个 wrong。
- 都改成 Heading 1, 保存。
- 插 TOC, 导出 PDF。
- 截图 + 写 report.md。
Source
- EyesOn-Bench Seed v12 改编 (5→15 标题, 加 H2 / FakeChapter decoy, 反 unzip / UNO 作弊)
Grading Criteria
-
- results/report.odt 存在
-
- 修复后 report.odt 中 outline-level=1 的 text:h 恰好出现 15 次 (>=14 仅得半分)
-
- results/report.pdf 存在 (>=10KB),pdftotext 能找到全部 15 个章节标题 (>=14 半分)
-
- report.md 中 wrong_titles 含 7/7 GT 名字 (>=6 半分,<6 不及格)
-
- tool_used 必须是白名单内取值 + 解释段 ≥ 80 字符 + 同时提到 Navigator 与 样式下拉/Style 之一
-
- proof.png 存在 ≥ 20 KB 且分辨率 ≥ 1024×600
-
- (audit) 没有 import uno / unzip .odt / 直接编辑 content.xml 作弊
-
- (HARD GATE) heading_count!=15 → 总分封顶 0.40;wrong_titles<6 → 封顶 0.45;PDF 缺失 → 封顶 0.50
-
- (VLM HARD GATE) proof.png 真显示 Navigator 15 条同级 H1;无 VLM 时总分封顶 0.60
Automated Checks
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'<text:h[^>]*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",
"<text:h",
"<text:p ",
"outline-level=",
"sed -i",
])
scores["audit_banned"] = a.get("any_banned", False)
scores["audit_screenshots"] = a.get("computer_screenshots", 0)
if a.get("any_banned"):
audit_cap = 0.25
# Weighted overall: core 60% / GUI evidence 30% / aux 10%
core = (
0.20 * scores["odt_exists"] +
0.40 * scores["heading_count_15"] +
0.15 * scores["pdf_exists"] +
0.25 * scores["pdf_has_15_sections"]
)
gui = (
0.55 * scores["wrong_titles_match"] +
0.30 * scores["mentions_gui"] +
0.15 * scores["proof_png"]
)
aux = (
0.30 * scores["report_exists"] +
0.30 * scores["tool_field"] +
0.40 * scores["explanation_len"]
)
base = 0.6 * core + 0.3 * gui + 0.1 * aux
scores["score_core"] = round(core, 3)
scores["score_gui"] = round(gui, 3)
scores["score_aux"] = round(aux, 3)
# Stricter non-VLM structural hard gates
if scores["heading_count_15"] < 1.0:
base = min(base, 0.40)
if h1_count == 0:
base = min(base, 0.20)
if scores["wrong_titles_match"] < 0.6:
base = min(base, 0.45)
if scores["pdf_has_15_sections"] < 1.0:
base = min(base, 0.60)
if not proof_ok:
base = min(base, 0.50)
scores["overall_score"] = round(base, 3)
# 8. VLM HARD GATE — stricter caps and penalty for missing VLM
vlm_done = False
if vlm_score_rubric and proof_ok:
rubric = {
"vlm_relevant_view": "proof.png 是 LibreOffice Writer Navigator 面板,或 Style 下拉框,或一份 PDF 的 TOC 页面;不是空白图、错误页、终端文本、桌面壁纸、文件管理器。",
"vlm_lots_headings": "proof.png 中能清楚数出 ≥ 14 条章节标题(无论是 Navigator entries 还是 TOC 行);恰好 15 条最佳。",
"vlm_no_h2_distractor":"proof.png 如果是 Navigator 截图,所有条目都在同一缩进层级 (即都是 H1),不再有 2 条以 H2 缩进;如果是 TOC,所有项是同级。",
}
try:
vlm = vlm_score_rubric([str(pp)], rubric,
instruction="判断 proof.png 是否真显示了 LO Writer Navigator 含 15 条同级 H1 (修复后状态)。")
for k in rubric: scores[k] = vlm.get(k, 0.0)
scores["judge_method"] = vlm.get("judge_method", "failed")
vlm_avg = sum(vlm.get(k, 0.0) for k in rubric) / len(rubric)
if scores.get("judge_method") not in ("failed", None, ""):
vlm_done = True
scores["overall_score"] = round(0.5 * base + 0.5 * vlm_avg, 3)
if scores.get("vlm_relevant_view", 0.0) < 0.6:
scores["overall_score"] = min(scores["overall_score"], 0.25)
if scores.get("vlm_lots_headings", 0.0) < 0.6:
scores["overall_score"] = min(scores["overall_score"], 0.40)
if scores.get("vlm_no_h2_distractor", 0.0) < 0.5:
scores["overall_score"] = min(scores["overall_score"], 0.55)
except Exception:
pass
# No VLM available → cap at 0.60 (can't fully trust GUI evidence)
if not vlm_done:
scores["overall_score"] = min(scores["overall_score"], 0.60)
if audit_cap is not None:
scores["overall_score"] = min(scores["overall_score"], audit_cap)
return scores
Workspace Path
workspace/DOC/task_2_heading_style_normalize
Skills
Env
Warmup
mkdir -p /tmp_workspace/results || true
chown -R user:user /tmp_workspace || true
rm -f /home/user/.openclaw/agents/main/sessions/*.lock 2>/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