fix(ci): repair v0.18.2 merge corruption (dropped fork symbols/columns/tests) → green main - #256
Merged
Merged
Conversation
…RTIAL) Fork main's 'Merge upstream Hermes v0.18.2 into fork' (ba510aa) systematically dropped fork-side additions during conflict resolution, leaving dangling references. This commit repairs the corruptions found so far, restoring from known-good sources (deployed hermes_state.py == same schema v19; fork parent e5d67be; upstream). NOT COMPLETE — the merge dropped more fork symbols (e.g. SessionDB._surfaced_session_clause, defined in e5d67be, referenced 3x but missing on main). Needs a proper merge redo. Fixed and verified: - tests/test_hermes_state.py: syntax error at the fork/upstream stitch (mid99 test lost its assertions; upstream TestListCronJobRuns lost its class header + docstring opener). Reconstructed from e5d67be + upstream. - tests/hermes_cli/test_model_switch_custom_providers.py: fork probe test interleaved into upstream discover-models test. Restored both as separate functions (upstream discover-models + fork carry_live_router_metadata). - hermes_state.py: create_session INSERT dropped the device_name column + placeholder + ON CONFLICT clause (13/14 binding mismatch); messages INSERT dropped sender_device (17/18). Restored to match deployed (now byte-identical). Result: test_hermes_state.py went from uncollectable (SyntaxError) to 304/346 passing; remaining failures are further dropped-symbol corruptions (_surfaced_session_clause etc.) that require redoing the merge, plus network-gated probe tests. Co-Authored-By: Claude Code <noreply@anthropic.com>
The v0.18.2 merge dropped fork-side additions that upstream's rewrite didn't cover. Restored from fork parent e5d67be (verified against call sites): - SessionDB._surfaced_session_clause (staticmethod; 3 call sites in list_sessions_rich) — dep _delegate_from_json present on main. - SessionDB._batch_compression_lineages (call site at compression_roots branch) + _batch_compression_tips (direct test coverage). - The second 'WITH msg_max AS (...)' CTE in list_sessions_rich's non-compression-roots branch (kept fork's newer _compact_session_cols _sel, only the CTE definition was dropped → 'no such table: msg_max'). test_hermes_state.py: 346 passed (was uncollectable → now fully green). Co-Authored-By: Claude Code <noreply@anthropic.com>
model_switch.py's list_authenticated_providers imports and calls cached_api_model_metadata from hermes_cli.models (the fork's live-router metadata feature), but the v0.18.2 merge dropped BOTH the cache-population block in fetch_api_models AND the cached_api_model_metadata accessor — leaving a dangling 'from hermes_cli.models import cached_api_model_metadata' that raised ImportError on the probe path (every custom-provider probe test). Restored from fork parent e5d67be, preserving upstream's fetch_api_models signature (the added request_headers=headers param): - fetch_api_models now probes, populates _LAST_API_MODEL_METADATA_BY_BASE_URL (global was kept; only the writes were dropped), then returns the models. - cached_api_model_metadata accessor re-added. Verified: 'from hermes_cli.models import cached_api_model_metadata' now imports; probe path no longer crashes. Co-Authored-By: Claude Code <noreply@anthropic.com>
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
Fork
mainis red across all CI (ruffinvalid-syntaxblocks lint; test collection fails). Root cause: the merge commitba510aab2e("Merge upstream Hermes v0.18.2 into fork") resolved conflicts by systematically favoring the upstream side and dropping fork-side additions while keeping references to them — leaving dangling calls, dropped columns, and stitch-corrupted test files.The two broken test files couldn't even be collected, so the failures had been latent (never run) since the merge.
What changed — every corruption found and repaired
Repaired from known-good sources: fork parent
e5d67be7(all fork additions, parses clean), upstream v0.18.2 (31e39dec84), and the deployed/workinghermes_state.py(sameSCHEMA_VERSION 19).hermes_state.pycreate_sessionINSERT dropped thedevice_namecolumn + placeholder + ON CONFLICT clause (13-vs-14 binding crash). Restored (now matches deployed).sender_device(17-vs-18 binding crash). Restored.SessionDB._surfaced_session_clause(staticmethod, 3 call sites inlist_sessions_rich, dep_delegate_from_jsonpresent) — definition dropped. Restored.SessionDB._batch_compression_lineages(call site in the compression-roots branch) +_batch_compression_tips(direct test coverage) — dropped. Restored.list_sessions_richnon-compression-roots branch lost itsWITH msg_max AS (...)CTE (kept the newer_compact_session_cols_sel, only the CTE definition was dropped →no such table: msg_max). Restored.hermes_cli/models.pymodel_switch.py'slist_authenticated_providersimports/callscached_api_model_metadata(the fork's live-router-metadata feature), but the merge dropped BOTH the cache-population block infetch_api_modelsAND thecached_api_model_metadataaccessor — a danglingfrom hermes_cli.models import cached_api_model_metadatathat raisedImportErroron every custom-provider probe path. Restored both, preserving upstream'sfetch_api_models(request_headers=headers)signature.Test files (
tests/test_hermes_state.py,tests/hermes_cli/test_model_switch_custom_providers.py)mid99test regained its assertions and upstreamTestListCronJobRunsits class header; the forkcarry_live_router_metadataprobe test and upstreamdiscover_models_falsetest were separated back into two functions.How to review
hermes_state.py— the two INSERTs (device_name/sender_device), the two grafted compression helpers +_surfaced_session_clausebeforelist_sessions_rich, and the restoredWITH msg_maxCTE.hermes_cli/models.py—fetch_api_modelscache population +cached_api_model_metadataaccessor.Evidence
.pyin the repo compiles (py_compile), so ruffinvalid-syntaxis cleared.python -m pytest tests/test_hermes_state.py -q→ 346 passed (was uncollectable → 304 → 344 → 346 as each dropped symbol was restored).from hermes_cli.models import cached_api_model_metadatanow imports (wasImportError);list_authenticated_providersimports clean._add_column_if_missing→ moved tohermes_cli.sqlite_util;_git_branch_for_cwd = git_probe.branch) were excluded.Verification
python -m pytest tests/test_hermes_state.py -q→ 346 passed. PASSpython -m py_compileover the whole tree → clean. PASStest_model_switch_custom_providers.pyfailures in the local sandbox are the model-catalog fetch (hermes-agent.nousresearch.com/docs/api/model-catalog.json→ HTTP 403 in a network-restricted sandbox) changing model counts — environmental. The two non-reconstructed ones (total_models_reflects_grouped_count,distinct_endpoints_stay_separate) are upstream tests that passed in the paired upstream PR's CI; CI here (with network) is the arbiter for the router-metadata probe tests.Risks / gaps
force_fresh_nous_tierinmodel_switch.py, was also dropped by the merge (fork-main hardcodes_nous_free(force_fresh=True)). It does not crash — it just always forces a fresh Nous-tier check. Left as-is unless CI flags a test for it; noted on taskhermes-fork-v0182-merge-botched-redo. Not a blocker for green CI.