fix(update): keep host-agent refresh non-fatal - #3159
Open
tang-vu wants to merge 1 commit into
Open
Conversation
This was referenced Aug 25, 2026
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.
Why this matters
A successful
ods updatecurrently exits beforeUpdate completewhen the optional host-agent refresh cannot start.cmd_updatelabels that refresh non-fatal and wraps it with|| warn, butcmd_agentreports hard lifecycle failures througherror(), which exits the current shell instead of returning. The caller's fallback therefore never runs. This is reachable on older/partial installs withoutbin/ods-host-agent.py, on hosts missing Python, and when the refreshed agent cannot become healthy; the Compose update has already verified and persisted its new version by then.Run on current
upstream/main, the public CLI fixture reproduced the abort withODS host agent script not foundafter service verification and version persistence.This change runs only the optional agent restart in a subshell. Agent stop/start side effects still occur normally, but an internal
exitis contained and converted into the existing warning so the verified update completes.Behavioral invariant: failure of the optional post-update host-agent refresh must be visible but must not roll an otherwise verified update into a false CLI failure.
Overlap check
Searched open and closed PRs for
CLI update host agent restart verification,host agent restart non-fatal update, and the exactRestarting host agenttext, plus opentang-vuPRs changing update paths andods-cli. No PR covers this failure. #2948 changes Windows OpenCode scheduled-task restart ownership; #2709 and #3066 change source/backup transactions inods-update.sh; #3156 changes custom install-root resolution. This scope is independent of #3158 and has no merge-order dependency.Changed production file searched:
ods/ods-cliaroundcmd_updateandcmd_agent.Regression test
tests/test-cli-update-verification.shinvokes the realods updatecommand against executable Docker/curl fixtures. The fixture intentionally omits the host-agent script, now asserts the non-fatal warning was exercised, and proves the command still reachesUpdate complete, persists the target version, verifies service failures honestly, and filters local build tags from pulls.Validation
bash tests/test-cli-update-verification.sh? 7 passed, 0 failedbash tests/test-ods-cli-pipefail-tolerance.sh? 16 passed, 0 failedbash -n ods-cli? passedbash -n tests/test-cli-update-verification.sh? passedgit diff --check? passedThe failure was also reproduced from a clean LF Linux worktree on the integration head after #3158. A live daemon upgrade was not performed; the boundary fixture proves the real CLI orchestration and executable failure path without mutating a host service.
Tradeoffs and rollback
The subshell is scoped to this best-effort refresh rather than weakening
cmd_agentitself: directods agent start/restartcommands must continue to fail when lifecycle requirements are missing. Rollback is isolated to the call site, but restores the mismatch between the documented non-fatal policy and actual shell exit behavior.Batch compatibility
This PR was validated on synthetic integration head
9af795fc, which applies #3158 through #3167 in numeric order onupstream/main(6ff9b4fc). Combinedmake lint,make test,make smoke,make simulate, and all 418 BATS cases passed (one root-specific permission assertion skipped by design).Recommended merge order: #3158 ? #3159 ? #3160 ? #3161 ? #3162 ? #3163 ? #3164 ? #3165 ? #3166 ? #3167. The only manual reconciliation observed was the adjacent Makefile test insertion shared by #3164 and #3166; retain both
test-unix-restart-recreate-env.shandtest-chat-error-exit-parity.shlines. Production code merged automatically across the full batch.