Skip to content

fix: intake honours declared Type, Target and Repos headers #472

Closed

Description

@Jammy2211

Overview

The Intake Agent mishandles declared prompt headers: an unknown Type: is dropped silently, declared Target: and Repos: are overridden by prose inference (incl. a phantom workspaces repo), and a leading header block becomes the title/slug and is echoed into the body. This makes intake honour declared Target and Repos, flag unknown Types visibly, and split the header block from the body.

Part of bundle pyautobrain-worktree-guards (one issue + one PR per member).

Plan

  • analyse: honour declared Target when normalise_repo(t) ∈ KNOWN_REPOS ∪ {"workspaces"} (same check as _sizing.py:691), else note + fall back to inference.
  • Honour declared Repos as written, in order, normalised via normalise_repo and validated against KNOWN_REPOS; unknown names dropped with a note; when Repos declared, prose mentions add nothing.
  • _split_header(text): strip leading # heading + contiguous header block of KNOWN keys only (key lines, Repos:/Themes: bullets, blanks) — must not eat a prose first line like "Status: …". Title from heading or first non-header line; write_prompt gets the body only.
  • target_source / repos_source shown "(declared)" in emit_human.
  • Keep test_intake_honours_a_prepended_header_block green. formalise/_derive_fields (~L3067) out of scope — mention in PR.
  • New tests/test_intake_declared_fields.py (NOT test_intake_dashboard.py — Codex is editing it):
    test_unknown_declared_type_is_flagged_not_silently_dropped, test_hygiene_maps_to_maintenance_with_a_visible_note, test_declared_target_is_honoured_and_homes_the_file (param autogalaxy/autofit/workspaces), test_declared_repos_taken_as_written_in_order, test_declared_repos_reject_unknown_names_with_a_note, test_leading_header_block_is_not_the_title_or_slug, test_header_block_is_not_echoed_into_the_body (write_prompt with tmp_path as Mind)
  • Run: python -m pytest tests/test_intake_declared_fields.py tests/test_declared_header_precedence.py tests/test_intake_*.py tests/test_skill_seams.py -q, then full suite.
  • Do not touch render_dashboard* (Codex's hunks).

Tier: notify — merge mode: auto-merge on green (in-turn wait, then /prm close-out). Brain has no PR test CI, so "green" = full Brain pytest suite passing locally in the worktree, reported before merge.

Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoBrain main clean

Suggested branch: feature/intake-declared-header-fields

Shared bundle worktree: ~/Code/PyAutoLabs-wt/pyautobrain-worktree-guards/ (PyAutoBrain only); members worked sequentially 1 → 4, each branch cut from origin/main. Human approved running in parallel with Codex's dashboard-minimal-text claim on PyAutoBrain.

Findings

all four defects reproduce on main 5d764f6 via analyse() on in-memory strings:
(1) Type: hygiene → dropped (declared_header in _sizing.py:523 returns None), inferred docs, no note;
(2) Target ignored — analyse (_intake.py:340) never reads it; infer_target picks first library in prose;
(3) Repos from prose only (_repos_in), sorted, phantom workspaces via config/policy.yaml:56 extra_workspace_targets;
(4) _title strips only inline spans → header line becomes title/slug; write_prompt (~L605) writes header + raw text → header duplicated in body.

Decision: unknown declared Type is NOT a hard error (would abort an intake ideas batch; intake reports declared-field problems as _risks notes and routes uncertainty to triage/). Small alias map (hygiene/upkeep→maintenance, tests→test, documentation→docs) applied with a visible note "Type hygiene declared → unknown, using maintenance"; any other unknown Type → folder triage with a note naming the valid WORK_TYPES set. _sizing.py untouched (test_declared_header_precedence.py asserts declared_header("Type: vibes") is None) — read raw values in intake via parse_header / parse_list_header.

Implementation Steps

  • analyse: honour declared Target when normalise_repo(t) ∈ KNOWN_REPOS ∪ {"workspaces"} (same check as _sizing.py:691), else note + fall back to inference.
  • Honour declared Repos as written, in order, normalised via normalise_repo and validated against KNOWN_REPOS; unknown names dropped with a note; when Repos declared, prose mentions add nothing.
  • _split_header(text): strip leading # heading + contiguous header block of KNOWN keys only (key lines, Repos:/Themes: bullets, blanks) — must not eat a prose first line like "Status: …". Title from heading or first non-header line; write_prompt gets the body only.
  • target_source / repos_source shown "(declared)" in emit_human.
  • Keep test_intake_honours_a_prepended_header_block green. formalise/_derive_fields (~L3067) out of scope — mention in PR.
  • New tests/test_intake_declared_fields.py (NOT test_intake_dashboard.py — Codex is editing it):
    test_unknown_declared_type_is_flagged_not_silently_dropped, test_hygiene_maps_to_maintenance_with_a_visible_note, test_declared_target_is_honoured_and_homes_the_file (param autogalaxy/autofit/workspaces), test_declared_repos_taken_as_written_in_order, test_declared_repos_reject_unknown_names_with_a_note, test_leading_header_block_is_not_the_title_or_slug, test_header_block_is_not_echoed_into_the_body (write_prompt with tmp_path as Mind)
  • Run: python -m pytest tests/test_intake_declared_fields.py tests/test_declared_header_precedence.py tests/test_intake_*.py tests/test_skill_seams.py -q, then full suite.
  • Do not touch render_dashboard* (Codex's hunks).

Original Prompt

Click to expand starting prompt

Intake Agent silently drops unknown Type values and overrides declared Target and Repos

Type: bug
Target: PyAutoBrain
Repos:

  • PyAutoBrain
    Difficulty: small
    Autonomy: safe
    Priority: medium
    Status: formalised
    Consequence: notify
    Witness: a pytest that feeds each of the four inputs above through the intake decision and asserts the written header equals the declared header, the path is under the declared target, and Type: hygiene raises/flags — red on main, green after the fix.
    Review-minutes: 0
    Unattended: ready

Observed across five /intake runs on 2026-09-16 (config-priors-drift follow-ups, config-yaml-comments prompt). The Intake (Conception) Agent, PyAutoBrain/agents/conductors/intake/_intake.py, mishandles declared headers in four ways, each requiring a hand fix of the written file:

  1. A declared Type: hygiene is not in WORK_TYPES (agents/faculties/sizing/_sizing.py, valid home is maintenance) and is DROPPED SILENTLY — the decision then infers feature or docs with no warning that the declaration was rejected. An unknown declared Type should be an explicit error or a visible "(declared: hygiene → unknown, using maintenance)" note.
  2. A declared Target: is overridden by the repo scraper (Target: autogalaxy → PyAutoArray; Target: autofit → PyAutoArray; Target: workspaces → PyAutoFit) and the file is re-homed under the wrong folder, although the decision prints Type/Difficulty/Autonomy/Priority as "(declared)". Target should be honoured the same way.
  3. A declared Repos: list is reordered, its names rewritten, and superset entries added from prose mentions — including a phantom workspaces repo that is not a repo — instead of being taken as written.
  4. When the header block is the first line of the input, the header line itself becomes the title/slug (draft/bug/autogalaxy/target_autogalaxy.md), and the raw header block is duplicated into the body below the real header.

Fix: honour declared Target and Repos exactly as Type/Difficulty/Autonomy/Priority are honoured; make an unknown declared Type an explicit error naming the valid set; derive the title from the first non-header line; do not echo the header block into the body. Add unit tests for each of the four inputs above. Related memory of traps: TargetIgn (declared Target ignored), hdr×5 (agent mangles declared headers).

Activity

  1. Jammy2211 commented on Oct 6, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    • PR: fix: intake honours declared Type, Target and Repos headers #476 — merged 2026-10-06 into main (a3a2ca3)
    • Summary: intake honours declared Type/Target/Repos headers; unknown Type goes visibly to triage (aliases mapped with a note); header block no longer becomes the title/slug.
    • Tests: new tests were red on the unfixed code first; full Brain suite green locally (PyAutoBrain has no PR test CI).
    • Part of bundle pyautobrain-worktree-guards; tier notify. No workspace impact (Brain tooling only); no release obligation.

    Closed by /prm close-out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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