fix(upgrade): capture an AGENTS.md composition failure instead of aborting on it - #608
Merged
Merged
Conversation
…rting on it upgrade.sh runs under `set -e`, and regenerate_agents_md is the only phase function in it with a non-zero return path. Called bare, one stale memory file did not degrade the run, it ended it: runtime guidance projection, claude-code runtime sync, runtime signature and instructions, subagents, both chat-bridge unit writers, the WordPress and worker service reconciliation, the installation profile, and print_summary all never executed. Nothing said so. The run stopped on the last warn line of the composition attempt, so the log reads as though it simply ended — no "Upgrade complete", no Updated list, no Pending list, and no statement that the remaining phases were skipped. Diagnosing the h44 nightly cost real time for exactly this reason: the output ends nowhere near the actual exit point. Capture it the way the same block already captures convergence_run, run the remaining phases, print the summary, and exit non-zero at the end. A stale AGENTS.md is worth failing the job over — that is how the underlying composition bug surfaced at all — but it is not worth abandoning service reconciliation halfway through. print_summary now names this case, because with every other phase converged a non-zero exit would otherwise have no visible cause in the summary. The test runs the real execute block against stubbed phases rather than asserting on source text, so dropping the capture fails it however the call is written. Against the unfixed script the transcript stops at regenerate_agents_md and all twelve later phases are reported missing, reproducing the live failure exactly. Fixes #607
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #607.
The problem
upgrade.shruns underset -e(line 63).regenerate_agents_mdis the only phase function in it with a non-zero return path, and it was called bare. So a faileddatamachine memory composedid not degrade the run — it ended it, at that line:Chat-bridge unit files, the WordPress and worker service reconciliation, and the installation profile left unconverged — because one memory file was stale.
And nothing said so. The run stopped on the last
warnline of the composition attempt, so the log reads as though it simply ended: no "Upgrade complete", noUpdated:, noPending:, and nothing stating that eleven phases had been skipped. That is what made the h44 nightly expensive to diagnose — the output ends nowhere near the actual exit point, so the obvious reading is that the failure lies in whatever ran last.The fix
Capture it the way the same block already captures
convergence_run:Run the remaining phases, print the summary, exit non-zero at the end. A stale AGENTS.md is worth failing the job over — that is how the underlying composition bug (Extra-Chill/data-machine#3512) surfaced at all — but it is not worth abandoning service reconciliation halfway through.
print_summarynames this case explicitly. With every other phase converged, a non-zero exit would otherwise have no visible cause anywhere in the summary:Verification
tests/agents-md-failure-does-not-abort-upgrade.shextracts the real execute block fromupgrade.shand runs it against stubbed phase functions, so it fails if the capture is dropped no matter how the call is rewritten — rather than asserting on source text, which would pass against a differently-worded regression.Against the unfixed script it reproduces the live failure exactly — the transcript stops dead at
regenerate_agents_md, matching the h44 log:With the fix:
Registered in the
shell.ymlmatrix;tests/ci-coverage.shpasses.agents-md-backup-retention,agents-md-composition-integration,plugins-only-scope,dead-mechanismandduplicate-mechanismall still pass.Context
This is the delivery half of the h44 nightly failure. The cause was Extra-Chill/data-machine#3512 (a root-created composition lock the service user could never open); this is why one wedged file took down the whole maintenance job instead of leaving a stale AGENTS.md behind. Worth fixing independently of that one — this turns any future composition fault into a reported failure rather than a silent truncation.