Skip to content

fix: prompt_sync_push commits only the paths it is given (M1.2) #554

Closed

Description

@Jammy2211

Overview

Programme task M1.2 (epic autonomous-orchestrators, phase 8). prompt_sync_push stages with git add -A (scripts/prompt_sync.sh:104), then commits and pushes with no guard. In the shared Mind checkout this has swept other sessions' edits into commits, committed conflict markers twice, and dropped live active.md entries. The ecosystem review confirmed it (FB-1, MIND-1). The helper should stage only the paths it is given and refuse anything unsafe.

Plan

  • prompt_sync_push "<msg>" <path>... stages only the given paths. It refuses when no paths are given.
  • It refuses, committing nothing, when the tree has changes outside those paths, when any staged file contains conflict markers, or when state.json (if staged) does not parse.
  • Tests in PyAutoMind cover each refusal and the happy path.
  • Every skill file that calls the helper passes its explicit paths (Mind's create_issue, plus 11 Brain skill and doctrine files).
  • prompt_sync_new_prompts keeps its own contract (new untracked prompt files only) and is checked for the same add -A pattern.

Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary

Detailed implementation plan

Affected Repositories

  • PyAutoMind (primary): scripts/prompt_sync.sh, tests, skills/create_issue/SKILL.md
  • PyAutoBrain: caller docs, namely skills/{intake/intake.md, start_library/start_library.md, start_dev/start_dev.md, start_dev_for_user/{start_dev_for_user.md,reference.md}, prm/reference.md, start_workspace/reference.md, ship_library/reference.md, ship_workspace/reference.md}, AUTONOMY.md, agents/conductors/batch/AGENTS.md

Suggested branch: feature/prompt-sync-explicit-paths in both repos. Merge Mind first: the Brain docs describe the new signature.

Implementation Steps

  1. scripts/prompt_sync.sh: change the signature to prompt_sync_push <message> <path> [path...].
    • Refuse with no paths.
    • Refuse when git status --porcelain lists changes outside the given paths. Untracked files outside the paths count too, unless ignored.
    • git add -- <paths> only. --no-renames-safe: a staged rename's deletion side must be inside the given paths, or the helper refuses.
    • Refuse when any staged file contains conflict markers (^<<<<<<< |^=======$|^>>>>>>> ).
    • Refuse when state.json is staged and does not parse.
    • Keep the existing current-branch push behaviour (7354a32).
  2. Tests (Mind's existing test layout): a throwaway git repo fixture with a bare remote, covering:
    • a dirty file outside the paths → refuse, nothing committed;
    • conflict markers → refuse;
    • bad state.json → refuse;
    • no paths → refuse;
    • the happy path commits exactly the given paths and pushes.
  3. Update every caller doc to pass explicit paths, with a one-line note of the refusal rules where the helper is introduced.

Witness

  • grep -n "add -A" scripts/prompt_sync.sh returns nothing.
  • A test with a dirty file outside the given paths shows the helper refuses and commits nothing.
  • A test with conflict markers in a staged file refuses, and so does one with an unparseable state.json.
  • The skill files that call the helper pass explicit paths.

Unattended: never: this is the helper every session uses to write Mind, so it ships with the human present.

Original Prompt

Click to expand starting prompt

prompt_sync_push: commit only the paths it is given

Type: bug
Target: PyAutoMind
Repos:

  • PyAutoMind
  • PyAutoBrain
    Difficulty: small
    Autonomy: supervised
    Priority: high
    Status: draft
    Filed: 2026-11-10
    Consequence: glance
    Witness: grep -n "add -A" scripts/prompt_sync.sh returns nothing; a test with a dirty file outside the given paths shows the helper refuses and commits nothing; a test with conflict markers in a staged file, and one with an unparseable state.json, both refuse; the skill files that call the helper pass explicit paths
    Review-minutes: 5
    Unattended: never
    Lane: any

Source: the ecosystem review of 2026-11-10, findings FB-1 and MIND-1, both confirmed by an independent verifier. Report: https://claude.ai/artifact/4A94P1cevvkESoM22QoMWm (private) and Science/scratch/ecosystem_review_2026-11/REPORT.md, sections B3 and B6 and Appendix A.

What was measured. Twelve feedback memories from 2026-05-10 to 2026-11-05 record write hazards in the shared Mind checkout. About six of them are a commit that swept up files the session did not own, and four of those came after the commit guard of 2026-07-16, three through prompt_sync_push. The helper still runs git add -A at scripts/prompt_sync.sh:104, then commits and pushes with no pull, rebase, retry or lock. PyAutoBrain/bin/mind_commit_guard.py has no reference to the helper and cannot see a helper call. Ten checked-in skill files still tell sessions to call it; only prm/reference.md warns about the add -A.

Recorded damage with one human and a few sessions: conflict markers committed twice, live active.md entries dropped and restored by hand, other sessions' edits swept into commits, and six completion records stranded on unmerged branches.

The change.

  1. prompt_sync_push takes explicit file paths and stages only those.
  2. It refuses when the tree has changes outside those paths, when any staged file contains conflict markers, or when state.json does not parse.
  3. Update the skill files that call it to pass their paths.

For autonomous shifts the one-Mind-writer rule is already enforced by a hook since 2026-11-03 (PyAutoBrain#560), so this fix is for every other session. The remote transport a cloud writer needs is a separate question and belongs in the cloud watcher design.

Unattended: never because this is the helper every session uses to write Mind; ship it with the human present.

Activity

  1. Jammy2211 commented on Nov 12, 2026

    @Jammy2211
    CollaboratorAuthor

    Heart RED override (development only), recorded per AUTONOMY.md.

    The live human authorized it in the programme session on 2026-11-12: "Override + merge on green". That covers the development-only RED override for this issue and the merge command (Mind PR first, then the Brain docs PR), on condition that every required check is green within the turn.

    Current RED reasons, verbatim (pyauto-heart readiness, ts 2026-11-12T17:29:04Z):

    • "PyAutoLens: on branch feature/shapelets-review (not main)"
    • "PyAutoLens: 2 uncommitted source change(s)"
    • "install verification FAILED (testpypi; checks F)"
    • "release validation FAILED (stage integrate)"

    None of these is in PyAutoMind or PyAutoBrain. Branch gates passed:

    • Mind suite: 750 passed.
    • Witness: no add -A left, and the refusal tests pass.
    • Independent review: CLEAN after one round of fixes.
    • Smoke: not applicable.

    PRs: #555 and PyAutoLabs/PyAutoBrain#605

    🤖 Generated with Claude Code

  2. added a commit that references this issue on Nov 12, 2026
  3. Jammy2211 commented on Nov 12, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped. Both PRs merged on green CI:

    Witness:

    • grep -n "add -A" scripts/prompt_sync.sh prints nothing.
    • The refusal tests for a dirty file outside the paths, conflict markers and a bad state.json pass.
    • Every skill call passes explicit paths.
    • The Mind suite gives 750 passed.

    Follow-ups are filed as draft/maintenance/pyautomind/prompt_sync_explicit_paths_followups.md.

    Programme M1.2 is done.

    🤖 Generated with Claude Code

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