Repository navigation
fix(cli): report daemon errors from ccc search without a traceback - #335
Open
hatemadi15 wants to merge 1 commit into
Open
hatemadi15 wants to merge 1 commit into
hatemadi15 wants to merge 1 commit into
Conversation
hatemadi15
marked this pull request as ready for review
November 9, 2026 19:42
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.
When the daemon reports an error,
ccc searchandccc statusdie with an unhandledRuntimeErrorand a Rich traceback of client frames, whileccc indexprintsIndexing failed: <error>and exits 1.Change
ccc searchcatches the error around the request, the way_run_index_with_progressdoes forccc index, and turns it into an unsuccessfulSearchResponse.Search failed: <error>branch ofprint_search_results. That branch was unreachable before (the daemon reports failures asErrorResponse, never assuccess=False), and it now exits 1.--jsonkeeps the contract from feat(cli): add --json flag to ccc search #216: the failure goes to stdout as JSON ("success": falseplus"message") and the command exits 1. Before this change it printed a traceback and nothing on stdout.ccc status, and the status requestccc indexmakes after indexing, go through one helper. It printsFailed to get project status: <error>and exits 1.DaemonStartErrorstill propagates to_catch_daemon_start_errorin all three.The other daemon-facing commands already handle this:
init(model check),doctorandresetcatch the error.mcpreturns it as a failed result.daemon statushandler only reads in-memory daemon state and loads no project, so there is no daemon-side failure for it to report.daemon restartanddaemon stopare daemon lifecycle and are unchanged.As with
ccc index, the message still ends with the daemon-side traceback that_daemon_errorappends (#270).Validation
I ran the real CLI against a real daemon, with LiteLLM pointed at a local fake OpenAI embeddings endpoint and a throwaway
HOMEandCOCOINDEX_CODE_DIR. Two daemon-side failures:initandindex, so the query embedding fails..cocoindex_code/settings.ymland stop the daemon, so the fresh daemon fails to load the project.mainccc search add two numbersRuntimeError: Daemon error: litellm.InternalServerError: ... Connection error., exit 1Search failed: Daemon error: litellm.InternalServerError: ... Connection error.and the daemon traceback, exit 1ccc search add two numbers --json{"type":"search","success":false,"results":[],"total_returned":0,"offset":0,"message":"Daemon error: litellm.InternalServerError: ..."}, exit 1ccc indexIndexing failed: Daemon error: Error loading .../settings.yml: while parsing a flow sequence ..., exit 1ccc search add two numbersRuntimeError: Daemon error: Error loading .../settings.yml: ..., exit 1Search failed: Daemon error: Error loading .../settings.yml: ..., exit 1ccc search add two numbers --json"success":falseand the message, exit 1ccc statusFailed to get project status: Daemon error: Error loading .../settings.yml: ..., exit 1A successful
ccc searchagainst the same project is unchanged: one result, exit 0.test_session_search_and_status_report_daemon_errorsintests/test_e2e.pyruns scenario B throughCliRunneragainst a real daemon (index,search,search --json,status). Withcli.pyreverted it fails (1 failed):RuntimeError: Daemon error: Error loading ...escapesccc search. With the fix it passes.uv run prek run --all-filespasses, including itsuv run pytest tests/ -vhook: 351 passed, 8 deselected. That ismain's 350 plus the new test.uv run ruff check .,uv run ruff format --check .anduv run mypy src/ tests/pass.uv run mypy .reports 2 errors inscripts/find_best_models.py, whichmainreports too.