Conversation
The background config monitor only uploads config.json back to the KSM record on its 30s interval tick, so stopping the container between ticks dropped any change written since the last tick -- notably the clone_code Commander rotates on each login -- and the next start served a stale config. Perform one final upload via the existing upload_config_to_ksm helper from stop_config_monitor before killing the monitor PID, guarded so it only runs when KSM mode is active and config.json exists and so a failed upload is logged but does not block shutdown.
mani-muon
marked this pull request as ready for review
October 1, 2026 23:30
Author
|
Hey @sk-keeper 👋🏽 -- May I please get a review on this PR? 🙇🏽 |
This branch has not been deployed
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.
Problem
When the entrypoint runs with
--ksm-config/--ksm-tokenand--record, it startsdocker_ksm_utility.py monitorin the background to push changes toconfig.jsonback to the KSM record. The monitor only uploads on its 30-second tick (MONITOR_INTERVAL=30). On container stop,cleanup_on_exit->stop_config_monitorkills the monitor without a final upload, so anything written toconfig.jsonsince the last tick is lost. Commander rotatesclone_codeon every login, so the next container start resumes from a stale config.Fix
In
stop_config_monitor, call the existingupload_config_to_ksmhelper once before killing the monitor PID. The call only runs when KSM mode is active (KSM_CONFIGorKSM_TOKENset,RECORDset,config.jsonpresent), and a failing upload is logged but does not block shutdown.upload_config_to_ksmas it stands.MONITOR_INTERVALis unchanged; this only adds a flush on shutdown.Testing
Local harness with a stubbed
python3onPATHthat records its argv and sleeps formonitorsubcommands:stop_config_monitorinvokesuploadexactly once, then kills the monitor PID.upload.upload.bash -n docker-entrypoint.shis clean.