Skip to content

fix(ci): repair v0.18.2 merge corruption (dropped fork symbols/columns/tests) → green main - #256

Merged
OmarB97 merged 3 commits into
mainfrom
fix/ci-repair-merge-corrupted-tests
Jul 8, 2026
Merged

fix(ci): repair v0.18.2 merge corruption (dropped fork symbols/columns/tests) → green main#256
OmarB97 merged 3 commits into
mainfrom
fix/ci-repair-merge-corrupted-tests

Conversation

@OmarB97

@OmarB97 OmarB97 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Problem

Fork main is red across all CI (ruff invalid-syntax blocks lint; test collection fails). Root cause: the merge commit ba510aab2e ("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/working hermes_state.py (same SCHEMA_VERSION 19).

hermes_state.py

  • create_session INSERT dropped the device_name column + placeholder + ON CONFLICT clause (13-vs-14 binding crash). Restored (now matches deployed).
  • messages INSERT dropped sender_device (17-vs-18 binding crash). Restored.
  • SessionDB._surfaced_session_clause (staticmethod, 3 call sites in list_sessions_rich, dep _delegate_from_json present) — definition dropped. Restored.
  • SessionDB._batch_compression_lineages (call site in the compression-roots branch) + _batch_compression_tips (direct test coverage) — dropped. Restored.
  • list_sessions_rich non-compression-roots branch lost its WITH 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.py

  • model_switch.py's list_authenticated_providers imports/calls cached_api_model_metadata (the fork's live-router-metadata feature), but the merge dropped BOTH the cache-population block in fetch_api_models AND the cached_api_model_metadata accessor — a dangling from hermes_cli.models import cached_api_model_metadata that raised ImportError on every custom-provider probe path. Restored both, preserving upstream's fetch_api_models(request_headers=headers) signature.

Test files (tests/test_hermes_state.py, tests/hermes_cli/test_model_switch_custom_providers.py)

  • Both had a merge stitch that spliced a fork test into an adjacent upstream test, producing a syntax error. Reconstructed: fork mid99 test regained its assertions and upstream TestListCronJobRuns its class header; the fork carry_live_router_metadata probe test and upstream discover_models_false test were separated back into two functions.

How to review

  1. hermes_state.py — the two INSERTs (device_name/sender_device), the two grafted compression helpers + _surfaced_session_clause before list_sessions_rich, and the restored WITH msg_max CTE.
  2. hermes_cli/models.pyfetch_api_models cache population + cached_api_model_metadata accessor.
  3. The two test files — the reconstructed function boundaries.

Evidence

  • Syntax sweep: every .py in the repo compiles (py_compile), so ruff invalid-syntax is cleared.
  • python -m pytest tests/test_hermes_state.py -q346 passed (was uncollectable → 304 → 344 → 346 as each dropped symbol was restored).
  • from hermes_cli.models import cached_api_model_metadata now imports (was ImportError); list_authenticated_providers imports clean.
  • Comprehensive dropped-symbol scan (fork parent vs main, dangling references only) surfaced these and no others once refactor false-positives (e.g. _add_column_if_missing → moved to hermes_cli.sqlite_util; _git_branch_for_cwd = git_probe.branch) were excluded.

Verification

  • python -m pytest tests/test_hermes_state.py -q → 346 passed. PASS
  • python -m py_compile over the whole tree → clean. PASS
  • Remaining 4 test_model_switch_custom_providers.py failures 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

  • One further upstream-side param, force_fresh_nous_tier in model_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 task hermes-fork-v0182-merge-botched-redo. Not a blocker for green CI.
  • The comprehensive fix here is scoped to dangling/broken fork drops (what breaks CI). Any silently-dropped fork feature with no test/reference is out of scope; the merge should still be reviewed holistically (tracked on the same task).

Omar Baradei and others added 3 commits July 8, 2026 15:47
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant