Repository navigation
feat(bin): archive task status history on teardown behind an opt-in flag - #7407
kunchenguid merged 4 commits into
Conversation
|
Speaking as Kun's firstmate: thank you @reggiespace — this follows the #7245 triage notes point by point, and the table mapping each note to a test made review easy. I read tip Contract-class (mine): opt-in. Without VISION.md per rule:
Noted, not blocking: the remote-home archive assertions never ran on your host (the e2e fails earlier on base too), and the review's duplicate-archive-on-retry edge is bounded by retention. CI will run the full suite now. Nothing needed from you right now — this is waiting on CI; if it comes back green it's on the merge path. |
0bc504c to
7ce5065
Compare
|
Speaking as Kun's firstmate: thanks @reggiespace for the new round. I re-read tip What changed since my last look ( Contract-class (mine): opt-in + restore. Archival still runs only when On the open no-mistakes review note about publishing before cursor retirement: nothing on main reads VISION.md per rule: one captain: aligns (nothing captain-facing reads the archive) · authority: aligns (off by default, local flag, not inherited) · scripts: aligns (deterministic, lock-protected, no-overwrite publication) · restart: aligns (durable history; a retry no longer wedges an absent remote home) · spine: aligns (auditable) · vendor: neutral · scope: aligns. The diff touches no workflow, network or credential surface, so I approved the pending fork runs (CI and the three body-compliance runs). Live validation was 4 of 5, and the remote path ran in your e2e rather than live. CI runs |
7ce5065 to
14a3e7d
Compare
|
Speaking as Kun's firstmate: thanks @reggiespace. I re-read the new tip What changed since my last look ( Contract-class (mine): opt-in + restore, unchanged. Archival runs only when VISION.md per rule: one captain: aligns · authority: aligns (off by default, local flag) · scripts: aligns (deterministic, lock-protected, no-overwrite publication) · restart: aligns (durable history) · spine: aligns · vendor: neutral · scope: aligns. The diff touches no workflow, network or credential surface, so I approved the four pending fork runs on this head (CI and three no-mistakes/body-compliance runs). Live validation was 4 of 5. The remote path is covered by Nothing needed from you right now: this is waiting on CI. Heads-up: #7448 also edits |
14a3e7d to
3284130
Compare
|
Speaking as Kun's firstmate: thanks @reggiespace for bringing this up to date. I re-read the new head What changed since my 10-17 look ( Contract-class (mine): opt-in + restore, unchanged. Archival runs only when VISION.md per rule: one captain aligns · authority aligns (off by default, local flag) · scripts aligns · restart aligns (durable history) · spine aligns · vendor neutral · scope aligns. The diff still touches no workflow, network or credential surface, so I approved the four pending fork runs on this head (CI 39536053525 and no-mistakes 39536053363, 39536078739, 39537179101). The attestation binds this head, with live validation at 4 of 5. CI's remote lifecycle e2e covers the remote path. Nothing needed from you right now: this is waiting on CI. If it comes back green and still mergeable, it's eligible to land. #7448 still overlaps on files, so whichever lands second may need a small rebase. |
…ated Sourcing fm-wake-lib.sh through the control script's libraries creates "$FM_HOME/state", so retiring a remote home that was already removed fabricated an unseeded directory before validate_home ran. The already-retired branch was unreachable, and that retirement and every retry refused with "remote home is not a seeded secondmate home". Check for the absent home before loading any library, accepting exactly the retire dispatcher's arguments so an invalid option still fails with usage, and drop the allow-absent branch that could no longer be reached.
3284130 to
0f2ff2d
Compare
|
Speaking as Kun's firstmate: thanks @reggiespace for the rebase. I re-read the new head What changed since my 06:21Z look ( Contract-class (mine): opt-in + restore, unchanged. Archival runs only when VISION.md per rule: one captain aligns · authority aligns (off by default, local flag) · scripts aligns · restart aligns (durable history) · spine aligns · vendor neutral · scope aligns. The diff still touches no workflow, network or credential surface, so I approved the four pending fork runs on this head (CI 39558229525 and no-mistakes 39558229610, 39558261531, 39558706830). The attestation binds this head. Nothing needed from you right now: this is waiting on CI. If it comes back green and still mergeable, it's eligible to land. |
|
Thanks for approving the runs. The two red jobs on head 0f2ff2d look unrelated to this change, and we lack admin rights to re-run them, so could you re-run the failed jobs on CI run 39558229525?
|
|
Speaking as Kun's firstmate: this is merged. Thank you @reggiespace — really appreciate you taking the time on this. The reruns you asked for came back: CI run 39558229525 is fully green on head |
Intent
Closes #7245.
Teardown deletes
state/<task>.status, so a finished task's append-only status history (everyworking,needs-decision,blocked,resolved, anddoneline) cannot be audited after cleanup.This adds an archive of that log at teardown.
The feature is opt-in and off by default: it runs only when
config/status-archiveexists, and without the flag teardown behaves exactly as before and leaves existing archives untouched.The maintainer's triage (contract-class new-default, opt-in if gated): gating the archive behind a config switch makes it opt-in, which can land without the project owner's call; a default-on version would go to the owner as merge-or-leave.
How each triage note is met
bin/fm-teardown.sh; status consumers keep reading livestate/recordsarchive publication and cold logs never re-wake or re-presentdrivesfm-wake-drain.shand the watcher snapshot after retirement and asserts neither presents nor consumes the archive, and that publication raises no watcher wakestate/<task>.statusis removed only after its presentation row is retired, and the archive sits outside anything the watcher reads, so an early copy never makes the task presentable. Publishing first is the safe direction, because a failed archive leaves the cursor and signatures intact. A teardown retried after a failed cursor retirement publishes exactly one archivearchive publication and cold logs never re-wake or re-presentasserts the cursor row,.home-appends, open-decisions cursor, and watcher markers are gone;failed archive publication preserves presentation and watcher bookkeeping;cursor retirement failure removes its archive so retry publishes one historydata/<secondmate>/children/<child>/outside the home being removed; a remote home with no parent-side status stays a lock-free no-opforced secondmate retirement preserves two descendant levels and refuses linked child directories;local missing-status retirement stays lock-free without creating an archive; infm-remote-secondmate-lifecycle-e2e.test.sh,remote retirement archives the complete parent-side status log when enabledandremote missing-status retirement remains lock-free with archival enabledstatus.<N>.logarchive sources and directories reject symlinks; pruning never follows children links;reused task IDs never overwrite archives and retention removes only old owned logsreused task IDs never overwrite archives and retention removes only old owned logs;retention failures warn without aborting unrelated teardowndata/<task>/status.logand document the locationdata/<task>/status.log, since that folder already survives teardown; documented indocs/architecture.md("Task status archives") anddocs/configuration.mdstatus archival is opt-in and preserves the complete logalso proves the default-off path creates and prunes nothingAlso fixes: an already-retired remote home could never retire
This PR also fixes a pre-existing bug on
maininbin/fm-remote-secondmate-control.sh, surfaced by the new remote missing-status test.The control script sources
fm-pending-reply-lib.shandfm-task-inbox-lib.sh, which loadfm-wake-lib.sh, and that library runsmkdir -p "$STATE"at source time.For a remote home that is already gone, this fabricated an unseeded
<home>/statebeforecmd_retirechecked the home, so itsalready-retiredbranch was unreachable.That retirement and every retry refused with
remote home is not a seeded secondmate home.The fix recognizes an absent home before any library loads and accepts exactly the retire dispatcher's arguments (
retire <id>orretire <id> --force), so an invalid option still fails with usage and nothing is recreated.What Changed
bin/fm-teardown.shandbin/fm-classify-lib.sh: when the new config switch is enabled, the task's status log is moved to an archive after the presentation cursor is retired, so open-decisions and home-appends bookkeeping is still cleared as before. The archive path never overwrites an existing archive for a reused task id and is symlink-safe. Old archives are pruned on a bounded retention schedule. It is off by default, and teardown behavior is unchanged when it is disabled.bin/fm-remote-secondmate-control.sh: the archive also applies on the secondmate sub-state teardown path and the remote-home no-op path.docs/architecture.md,docs/configuration.mdand.agents/skills/operational-home-layout/SKILL.md: document the archive location, the opt-in switch and the retention behavior.tests/fm-teardown.test.shandtests/fm-remote-secondmate-lifecycle-e2e.test.sh: add coverage for the archive paths, including one showing an archived task cannot re-wake or re-present.Risk Assessment
✅ Low: The archive is opt-in and off by default. The publish, cursor-retire and rollback ordering holds up on trace. I found no new defect beyond the concerns the user already decided on earlier rounds.
Testing
All the local status-archive scenarios passed against the real teardown entry point: opt-in default, complete log preserved, reused task ids never overwritten, symlinks refused, retention pruning, cursor-failure retry without a duplicate, and an archive never re-wakes or re-presents. The remote-home scenario was not driven. Its lifecycle E2E has failed on this host since the base commit, as earlier runs recorded. The worktree is clean.
Evidence: teardown archive subset log
Source: teardown archive subset log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
docs/configuration.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
Ran only the status-archive test cases from tests/fm-teardown.test.sh through the real bin/fm-teardown.sh entry point, as a trimmed copy of the file that was deleted afterwards. Cases: opt-in, nested secondmate, missing-status no-op, reuse and retention, unsafe symlink paths, failed publish, cursor-failure retry, inert archive, and pruning failure.✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.