Commit Graph

14 Commits

Author SHA1 Message Date
teknium1 8e0b1a2e47 fix(update): keep the config-migration purge and reload inside the fail-open guard
_purge_stale_hermes_modules evicts hermes_cli.* but not root modules
(hermes_constants, utils, toolsets, ...), so the post-purge
`from hermes_cli.config import ...` re-executes the NEW config.py against
OLD cached root modules. When a pull adds a root-module symbol that
config.py imports at module level, that raises ImportError. The import
sat outside the step's try/except, so the error escaped
_run_post_update_maintenance and aborted the fleet restart -- where
origin/main printed the "Could not check config version / run hermes
config migrate" fallback and continued. Move the purge, reload and
import inside the existing try so the step stays fail-open.

Test: a cached hermes_constants lacking get_process_hermes_home (the
symbol hermes_cli/config.py imports at module level) must print the
fallback and return instead of raising. Red before, green after.

Review finding: fail-open -> fail-closed flip; post-purge hermes_cli.config import outside the try let ImportError abort post-update maintenance.
2026-09-15 04:10:27 -07:00
teknium1 24a623e557 fix(update): purge stale Hermes modules before post-pull config migrations
The pinned-list reload (tools_config) fixes the reported symbol; any
future symbol a pull adds to any module a migration imports at call time
(agent.skill_utils, hermes_cli.toolset_scope, ...) would fail the same
way. Evict every cached Hermes module at the migration entry point with
_purge_stale_hermes_modules — the class fix the fleet-restart phase
already relies on — so the migration graph is rebuilt from the new tree.

Tests: the reporter's exact shape (cached tools_config lacking
_configurable_keys, on-disk v44 config with an explicit platform
toolset list) must still migrate v44 -> v45 through the updater's own
entry point. Existing entry-point tests stub the purge like the rest of
the update suite does.
2026-09-15 04:10:27 -07:00
liuhao1024 91a3ab4c85 fix(update): reload the cached tools_config before post-pull migrations
The updater process is the pre-pull process: hermes_cli.tools_config cached in sys.modules lacks symbols the pull added, so a migration that imports them at call time fails with ImportError and the config silently stays at the old version (#111271).
2026-09-15 04:10:27 -07:00
Teknium e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
2026-09-03 09:44:26 -07:00
Teknium 0071ba9965 Merge origin/main (561b053f79) into simp/forwardport: forward-port 220 main commits into the simplified tree 2026-09-03 03:31:03 -07:00
Teknium f7cd31b08f refactor(hermes_cli): uninstall/update_cmd_config/update_abort_recovery — _unlink_if, _ask_configure_new_options, safety-net line builders, _run_fresh_recovery_process/_parse_serve_units, compact docstrings 2026-09-02 23:11:19 -07:00
Teknium 1767ee8119 refactor(hermes_cli): compact docstrings/comments in update_cmd*, update_abort_recovery, uninstall (keep every WHY) 2026-09-02 21:28:27 -07:00
Teknium a8e8db4fc5 refactor(hermes_cli): AST-neutral string-literal joins and import-blank squeeze in update_cmd*/uninstall 2026-09-02 21:12:29 -07:00
Teknium adba16445a refactor(hermes_cli): AST-neutral layout compaction of update_cmd*/uninstall (hug brackets, pack args) 2026-09-02 20:27:53 -07:00
Teknium 832f77939a refactor(update): lift snapshot safety nets out of _check_and_apply_config_migration (192 -> 130 LOC) 2026-09-02 16:57:00 -07:00
Teknium 60041b787a refactor(update): join short multi-line statements onto one line (AST-identical, -416 lines) 2026-09-02 16:52:38 -07:00
Teknium d46eb1f964 refactor(update): collapse 90 try/except-pass and try/except-logger.debug blocks into suppress()/_best_effort() (new leaf update_cmd_common.py) 2026-09-02 16:34:55 -07:00
Teknium a59680217f refactor(update): hand-compact comments/docstrings in split modules (AST-identical); re-export get_hermes_home/shutil; repoint source-inspection tests 2026-09-02 16:11:02 -07:00
Teknium 4674f8b254 refactor(update): split zip/stash/config/deps/git/maint clusters out of update_cmd.py 2026-09-02 16:00:26 -07:00