Skip to content

fix: fail loud with a clear message when the harness CLI is missing from the worker - #861

Open
JoeJoeflyn wants to merge 1 commit into
Fergana-Labs:mainfrom
JoeJoeflyn:fix/curator-missing-cli-clear-error
Open

fix: fail loud with a clear message when the harness CLI is missing from the worker#861
JoeJoeflyn wants to merge 1 commit into
Fergana-Labs:mainfrom
JoeJoeflyn:fix/curator-missing-cli-clear-error

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fail loud with a clear, actionable error when the harness CLI (claude/codex/opencode) is missing from the worker host, instead of the cryptic FileNotFoundError from issue #780.

Changes

  • backend/services/sprite_agent_service.py: check shutil.which(auth.harness.bin) before spawning the subprocess in run_chat; raise RuntimeError naming the missing binary if absent
  • backend/tests/test_curator.py: added test_missing_cli_raises_clear_error — mocks shutil.which to return None, asserts the error names claude and mentions PATH

Related issues

References #780

Test plan

  • Existing tests pass (python -m pytest backend/tests/test_curator.py -v — 22 passed)
  • New tests added (test_missing_cli_raises_clear_error)
  • Tested manually — started the self-hosting stack via docker-compose.prod.yml, confirmed claude is absent from the worker container, reproduced the original FileNotFoundError, then confirmed the new check raises a clear RuntimeError naming the binary

@assert-app

assert-app Bot commented Jul 19, 2026

Copy link
Copy Markdown

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@JoeJoeflyn is attempting to deploy a commit to the fergana Team on Vercel.

A member of the Team first needs to authorize it.

@henry-dowling

Copy link
Copy Markdown
Collaborator

Thanks for the PR! Will take a look soon

@ColemanDuPlessie ColemanDuPlessie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One note that the codebase previously didn't use the shutil python library in backend/, only in the CLI and plugins. It's probably fine, but perhaps something to be aware of.

@JoeJoeflyn

Copy link
Copy Markdown
Contributor Author

My bad! I didn't notice backend/ wasn't using shutil before. Do you want me to remove it and use a different approach instead?

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stash-web Ready Ready Preview, Comment Jul 20, 2026 7:56pm

Request Review

@ColemanDuPlessie

Copy link
Copy Markdown
Collaborator

That's alright! Given that we already use shutil elsewhere in stash, it's okay to also introduce it into backend/

It seems like this change is causing a couple of the backend tests to fail (there are 6 failures in the CI, and all but test_integration_indexer_log_security.py::test_github_index_success_logs_internal_source_id_only come from this change): it looks like they're all coming from the fact that our pre-existing tests trip up your code and cause it to fail loud when it doesn't recognize the tests' mocks. Other than that, this PR looks good, so once that's fixed, we can merge it!

@JoeJoeflyn

Copy link
Copy Markdown
Contributor Author

Thanks, really appreciate it! Glad I could help improve this. Happy to contribute!

@henry-dowling

Copy link
Copy Markdown
Collaborator

Hey @JoeJoeflyn do you plan on addressing the test failures here? Lmk otherwise I'm gonna close since this is getting stale

@JoeJoeflyn

Copy link
Copy Markdown
Contributor Author

yep, i forgot this

@JoeJoeflyn
JoeJoeflyn force-pushed the fix/curator-missing-cli-clear-error branch 2 times, most recently from 8ed0adc to fb0ae2e Compare August 12, 2026 13:20
…rom the worker

When the harness CLI (claude/codex/opencode) isn't installed on the
worker host, the curator task crashed with a cryptic FileNotFoundError
from deep in asyncio — "No such file or directory: 'claude'" — that
didn't tell the operator what to install. Check shutil.which() before
spawning and raise a RuntimeError that names the missing binary and
says to install it on the worker host.

References Fergana-Labs#780
@JoeJoeflyn
JoeJoeflyn force-pushed the fix/curator-missing-cli-clear-error branch from fb0ae2e to 9e1a196 Compare August 12, 2026 13:37
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.

3 participants