Skip to content

fix(bin): refuse task id reuse when data directory exists - #2

Open
BohnBawerick wants to merge 2 commits into
mainfrom
fm/fm-task-id-reuse
Open

fix(bin): refuse task id reuse when data directory exists#2
BohnBawerick wants to merge 2 commits into
mainfrom
fm/fm-task-id-reuse

Conversation

@BohnBawerick

Copy link
Copy Markdown
Owner

Intent

Refuse task id reuse in fm-brief.sh when a data/ directory already exists to protect retained reports and prevent stale task instruction collisions

What Changed

  • Added a validation in bin/fm-brief.sh that requires a task ID and refuses brief creation if $DATA/<id> already exists, reporting the existing path contents and exiting with an error.
  • Added tests in tests/fm-brief.test.sh verifying task ID reuse refusal across existing files and directories, and updated test teardowns to remove full task data directories.
  • Added a retry loop in tests/fm-calm-pi-extension.test.sh when capturing tmux pane contents.

Risk Assessment

✅ Low: The change cleanly refuses task ID reuse when a task data directory already exists, protecting retained artifacts with clear error reporting and thorough test coverage.

Testing

Executed targeted unit tests in tests/fm-brief.test.sh and performed end-to-end verification of bin/fm-brief.sh demonstrating refusal on existing data/<id> directories/files and report preservation, with evidence recorded in /tmp/no-mistakes-evidence/01M0AZQVAQWN146YANWJVWCVBY/task-id-reuse-cli-transcript.txt.

Evidence: CLI transcript demonstrating task ID reuse refusal and retained report preservation

Source: CLI transcript demonstrating task ID reuse refusal and retained report preservation

=== Scenario 1: Refusing task ID reuse with existing retained report ===
[Attempting to scaffold task-101]
error: task id 'task-101' already exists at /tmp/tmp.LMGXHKvA1H/demo-home/data/task-101 (contains: report.md); choose a distinct task id (e.g. 'task-101-2' or mint a new one) to preserve retained history and avoid collisions
[Command exited non-zero as expected]
[Checking preserved report.md content:]
Original report from previous run
[Checking brief.md does not exist:]
brief.md is absent (protected)

=== Scenario 2: Refusing task ID reuse with multiple artifacts ===
[Attempting to scaffold task-102 with --scout]
error: task id 'task-102' already exists at /tmp/tmp.LMGXHKvA1H/demo-home/data/task-102 (contains: brief.md, report.md); choose a distinct task id (e.g. 'task-102-2' or mint a new one) to preserve retained history and avoid collisions
[Command exited non-zero as expected]

=== Scenario 3: Refusing task ID reuse with empty directory ===
[Attempting to scaffold task-103 with --mode direct-PR]
error: task id 'task-103' already exists at /tmp/tmp.LMGXHKvA1H/demo-home/data/task-103 (empty directory); choose a distinct task id (e.g. 'task-103-2' or mint a new one) to preserve retained history and avoid collisions
[Command exited non-zero as expected]

=== Scenario 4: Refusing task ID reuse with existing file ===
[Attempting to scaffold task-104 with --mode local-only]
error: task id 'task-104' already exists at /tmp/tmp.LMGXHKvA1H/demo-home/data/task-104 (existing file); choose a distinct task id (e.g. 'task-104-2' or mint a new one) to preserve retained history and avoid collisions
[Command exited non-zero as expected]

=== Scenario 5: Successful scaffolding with fresh/unused task ID ===
[Attempting to scaffold task-105 with --mode no-mistakes]
scaffolded: /tmp/tmp.LMGXHKvA1H/demo-home/data/task-105/brief.md (ship, mode=no-mistakes; replace {TASK})
[Command exited 0 as expected]
[Checking brief.md was created:]
brief.md successfully generated

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-brief.test.sh
  • bin/fm-brief.sh task ID reuse refusal verification across existing retained report, multi-artifact directory, empty directory, existing file, and fresh ID creation
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

"

kunchenguid and others added 2 commits August 18, 2026 00:05
…chenguid#2570)

* fix(bin): report remote secondmate delivery and state truthfully

A steer to a remote secondmate crosses fm-on.sh to a host-local fm-send
leg whose unconfirmed submit read-back (verdict=pending, typically a busy
mate whose harness queues the steer) was flattened into exit 1, so the
parent printed "error: text not submitted" / "error: text not sent" and
discarded the pending-reply expectation for a steer that had actually
landed. fm-send now carries the verdict across the ssh boundary as a
documented delivered-unconfirmed exit 3: the parent reports the steer as
delivered with confirmation pending, exits 0, keeps the expectation armed
(awaiting_report), and closes --resolve-key decisions, while transport
loss (ssh 255) and real remote failures keep failing loudly with the
remote leg's stderr attached. A local unconfirmed submit now also exits 3
with an honest non-error message and still never closes a decision key.

fm-crew-state.sh and fm-peek.sh no longer read a remote mate's endpoint
through local probes (which misreported a healthy mate as "worktree gone"
/ "can't find session: remote"): both now use the true remote source over
fm-on.sh, and an unreachable or unreadable remote reads as unknown-remote,
never as gone or dead.

* no-mistakes(document): Document remote delivery and state truth

* no-mistakes: apply CI fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants