Stop the Windows bar wrapper discarding the finals gate's answer - #109
Merged
Conversation
Found on the real box. The wrapper this repo ships ran --metadata straight after --bars with no guard, and a .cmd exits with the code of its LAST command. So a deferral's exit 1 was overwritten by --metadata's exit 0: Task Scheduler recorded SUCCESS, restart-on-failure never fired, and the task waited until the next day having fetched nothing. That is the precise failure --require-final exists to prevent, reintroduced one layer out. The gate computed the right answer every night and the wrapper threw it away, and the symptom is the one this whole session keeps circling -- a green run that did nothing. The fix keeps the bars exit code and stops there. Skipping --metadata on a defer is deliberate rather than incidental: restart-on-failure turns this task into a poll loop, and each retry should be the cheap date compare the gate is, not a full contract-spec fetch of every symbol against NDU. `if errorlevel 1` tests >= 1 and needs no expansion, so it is safe on one line. `|| exit /b %ERRORLEVEL%` would NOT be, and is worth naming because it is the obvious thing to reach for: cmd expands %ERRORLEVEL% when it PARSES the line, before the command on that line has run, so it returns the previous command's code. On its own line, after the command, it is correct. Not executable in this sandbox -- there is no cmd here -- so this is reasoned from cmd's parse-time expansion rules and from the exit codes on the Python side, which were read rather than remembered: a deferral returns 1, --metadata returns 0. Confirm on the box with Last Run Result on a deferred run: it must be 0x1, not 0x0.
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.
Found on the real Windows box while repointing it after the ADR-0007 removals.
The bug
The wrapper this repo ships ran
--metadatastraight after--barswith no guard, and a.cmdexits with the code of its last command:So a deferral's exit 1 was overwritten by
--metadata's exit 0. Task Scheduler recorded success, restart-on-failure never fired, and the task waited until the next day having fetched nothing.That is exactly the failure
--require-finalexists to prevent, reintroduced one layer out: the gate computed the right answer every night and the wrapper threw it away. Same symptom this whole migration keeps producing — a green run that did nothing.The fix
Skipping
--metadataon a defer is deliberate, not just convenient. Restart-on-failure turns this task into a poll loop, and each retry should be the cheap date compare the gate is — not a full contract-spec fetch of all 49 symbols against NDU.Why
if errorlevel 1and not||.if errorlevel 1tests>= 1and needs no variable expansion, so it is safe on one line.|| exit /b %ERRORLEVEL%would not be, and it is worth naming because it is the obvious thing to reach for: cmd expands%ERRORLEVEL%when it parses the line, before the command on that line has run, so it returns the previous command's code. On its own line, after the command, it is correct.Also adds
setlocaland quotes theset, matching the other wrappers.Verification, and its limit
There is no
cmdin this sandbox, so this is reasoned from cmd's parse-time expansion rules, not executed. What I did check rather than remember: the Python exit codes on the other side — a deferral returns1,--metadatareturns0.Confirm on the box with Last Run Result on a deferred run: it must be
0x1, not0x0.ruffclean, 199 pass (docs/examples only — no source touched).Generated by Claude Code