Skip to content

fix: SPECIAL:autonomy_log parses live bytes and can leak the whole ledger #123

Description

@Jammy2211

Overview

autonomy_log_body() in scripts/spawn.py reads the live autonomy_log.md and copies lines until one starts with |---. That is the same "trust the live file's shape" pattern that made empty_body() stamp live registry entries into the public templates (#118) — it just has not fired yet.

Pre-existing; surfaced by the independent Codex review of #118. Sibling half of #121.

for line in lines:
    kept.append(line)
    if line.startswith("|---"):
        break

Both failure modes reproduced against the real ledger

hazard result
a task row inserted above the separator that row is copied into the template
separator reformatted to | --- | (a cosmetic edit any markdown formatter makes) the break never fires — 231 live task records copied

And the canary scan does not save us. A leaked row containing no dataset or person token returns zero hits — verified. The full-ledger case happens to be caught today only because some rows mention slacs1430 / B1938 / cosmos_web_ring. That is luck, not a guarantee, and it is precisely the reasoning that made the #118 leak invisible.

Fix

Same shape as #118: generate the schema header as a constant asset instead of parsing it out of the live ledger. No source bytes, no shape assumptions — the file is never opened.

The header is entirely generic (title, the prose explaining the log, the Outcome ∈ … legend, the table header and separator) and references only PyAutoBrain/AUTONOMY.md, which a fresh org has. The constant reproduces the currently-published bytes exactly, so this introduces no gratuitous template drift.

Detailed implementation plan

Affected Repositories

  • PyAutoMind (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoMind main clean

Suggested branch: feature/spawn-autonomy-log-generated

Implementation Steps

  1. docs/pyautobrain/spawn_spec.md — state that the autonomy_log skeleton is GENERATED, not parsed, with the same wording discipline as rule 5 (edit spec first).
  2. scripts/spawn.py — add AUTONOMY_LOG_TEMPLATE beside the other generated assets; replace autonomy_log_body()'s parse loop so it never reads src.
  3. tests/test_spawn_privacy.py — extend test_generated_tree_contains_no_live_content fixtures with (a) a row above the separator and (b) a | --- | separator; both must still yield a clean template. Add a direct test that the function does not open the source.

Key Files

  • scripts/spawn.pyautonomy_log_body() (~line 535), generated-assets block
  • docs/pyautobrain/spawn_spec.md — Mind table rule 5
  • tests/test_spawn_privacy.py

Original Prompt

Click to expand starting prompt

draft/bug/pyautomind/spawn_autonomy_log_parses_live_bytes.md — split from the bundled instance-state prompt filed during the #118 review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions