feat: return ok=true with git_repo=false when bg status is run outside a git repo#898
feat: return ok=true with git_repo=false when bg status is run outside a git repo#898
Conversation
…e a git repo Previously, running 'git ai bg status' outside of a git repository would return ok=false with a git rev-parse error. Now it gracefully returns ok=true with git_repo=false to indicate the command succeeded but the current directory is not a git repository. Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
The bg status response now includes daemon_running alongside git_repo=false so the caller can confirm the daemon is alive even outside a git repository. Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
Test ResultsTested locally by building the debug binary and running Primary: bg status outside a git repo
Regression: bg status inside a git repo
CI Note: One flaky failure in |
Summary
When
git ai bg statusis run outside a git repository, it previously returnedok: falsewith agit rev-parseerror from the daemon. This change adds an early check in the client-sidehandle_statusfunction: before contacting the daemon, it verifies the path is inside a git repo usingfind_repository_in_path. If not, it skips the family-level status query but still checks daemon health viadaemon_is_up, returning:{ "ok": true, "git_repo": false, "daemon_running": true }Normal in-repo behavior is unchanged.
Review & Testing Checklist for Human
{ "ok": true, "git_repo": false, "daemon_running": bool }) is a different shape than the normalControlResponse({ "ok", "seq", "data", "error" }). Verify that all consumers ofbg statusoutput can handle this divergent schema, or decide ifgit_repo/daemon_runningshould be nested inside the standardControlResponsestructure instead.find_repository_in_path(...).is_err()treats any error (permissions, git binary missing, corrupt repo, etc.) as "not a git repo." Consider whether some errors should still surface as failures rather than being silently mapped togit_repo: false.git ai bg statusfrom/or/tmp(outside any repo) and confirm the new JSON output includesdaemon_running. Then run it inside a repo and confirm normal behavior is unchanged.Notes
daemon_is_upchecks socket connectivity (control + trace sockets respond within 100ms); it does not issue a full control request.Link to Devin session: https://app.devin.ai/sessions/37f5a9c05ad346f587f3cf512e4e58f5
Requested by: @svarlamov