fix(cli): surface generation-phase embedder degradation - #1851
Conversation
The init header probes the embedder and warns on degradation, but the generation phase rebuilds it. If that second build fails (Ollama stops mid-run, a key is revoked between header and generation), the run writes mock (keyless) vectors and a scripted run records a clean state.json with nothing saying so. Record the degradation on result in run_repo_generation (the shared generation entry) and fold it into the persisted 'degraded' list in both the single-repo and workspace init flows, so a degraded generation-phase embedder is reported exactly like a header-probe degradation. mock stays silent: reaching the keyless default is not a failure.
|
✅ Health of changed files: 2.3 → 2.5 (+0.2) 📋 At a glance Files & modules (2)
✅ Health gate: passed 📌 Before you merge
🔎 More signals (3)🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (3 with dependents)"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py[".../init_cmd/command.py 🔥"]:::changed
f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py[".../init_cmd/generation.py 🔥"]:::changed
f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py[".../init_cmd/workspace.py 🔥"]:::changed
end
f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py[".../doctor_cmd/repo_checks.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py[".../generate_cmd/command.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
f_packages_cli_src_repowise_cli_commands_hook_cmd_py[".../commands/hook_cmd.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_hook_cmd_py
f_packages_cli_src_repowise_cli_commands_init_cmd___init___py[".../init_cmd/__init__.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
f_packages_cli_src_repowise_cli_commands_upgrade_flow_py[".../commands/upgrade_flow.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py --> f_packages_cli_src_repowise_cli_commands_upgrade_flow_py
f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
w_packages_cli_src_repowise_cli_helpers_py(["⚠️ .../cli/helpers.py changed together 13×, not in PR"]):::warn
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_helpers_py
w_packages_cli_src_repowise_cli_ui_mode_selection_py(["⚠️ .../ui/mode_selection.py changed together 12×, not in PR"]):::warn
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_ui_mode_selection_py
t_tests_unit_cli_test_edenai_reachability_py(["✅ .../cli/test_edenai_reachability.py"]):::guard
t_tests_unit_cli_test_edenai_reachability_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
t_tests_unit_cli_test_file_page_volume_prompt_py(["✅ .../cli/test_file_page_volume_prompt.py"]):::guard
t_tests_unit_cli_test_file_page_volume_prompt_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py
t_tests_unit_cli_test_workspace_deterministic_py(["✅ .../cli/test_workspace_deterministic.py"]):::guard
t_tests_unit_cli_test_workspace_deterministic_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (5 direct dependents, from the last indexed snapshot). Dashed: history/tests. 🔥 Hotspots touched (4)
1 more
🔗 Hidden coupling (1 file)
👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR |
Ayush7614
left a comment
There was a problem hiding this comment.
Verified diff: packages/cli/src/repowise/cli/commands/init_cmd/generation.py:1 records build-time degradation to result.embedder_degraded and folds into state.json degraded for both single-repo (command.py) and workspace (workspace.py) flows, as described for #1369. mock stays silent correctly. Dedicated regression tests in test_init_failure_reporting.py verify degraded vs healthy vs mock. Low risk, honest fix — LGTM, no fake content.
Fixes #1369.
Problem
The init header probes
build_embedderand warns on degradation, but the generation phase rebuilds the embedder inrun_repo_generation. If that second build fails — Ollama stops mid-run, an API key is revoked between the header probe and generation — the run writes mock (keyless) vectors with no record instate.json, so a scripted/agent run exits 0 and records a clean index despite having no semantic search.Approach
Record the degradation on
resultin the shared generation entry (init_cmd/generation.py), then fold it into the persisteddegradedlist in both init flows:command.py): appended torun_warnings, which flows intostate.json["degraded"](andsave_full_state_and_config).workspace.py): written into the per-repostate.jsondegradedkey.mockstays silent — reaching the keyless default is not a failure.Test
Added
TestGenerationPhaseEmbedderDegradationintest_init_failure_reporting.py:ollama) that degrades toKeylessEmbedderrecordsresult.embedder_degraded;mockdefault stays silent;Verified the regression test fails without the fix (sabotage run).
Risk
Low. Only adds a
resultattribute and two glue lines; no behavior change for healthy or keyless-default runs. Full CLI unit suite: 2192 passed (1 pre-existing platform-baseline failure unrelated to this change).Exclusions
Ollama down at embed time (not build time) is already surfaced by the existing per-page stub-fallback reporting; this closes the build-time gap the issue describes.