Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(server,ui): surface control failures and reset started_at on PID change

cyha007ca99a206
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index b9adfa82b..8fc17f068 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -118,6 +118,8 @@ export const Dashboard: React.FC = () => {
setLoading(true);
try {
await control(action);
+ } catch (e) {
+ console.error('Service control action failed', e);
} finally {
setLoading(false);
}
diff --git a/ui/src/components/settings/SettingsServicePage.tsx b/ui/src/components/settings/SettingsServicePage.tsx
index e2957ac3c..b621209ae 100644
--- a/ui/src/components/settings/SettingsServicePage.tsx
+++ b/ui/src/components/settings/SettingsServicePage.tsx
@@ -32,6 +32,8 @@ export const SettingsServicePage: React.FC = () => {
setLoading(true);
try {
await control(action);
+ } catch (e) {
+ console.error('Service control action failed', e);
} finally {
setLoading(false);
}
diff --git a/ui/src/context/StatusContext.tsx b/ui/src/context/StatusContext.tsx
index 955fd2b32..f350cc72f 100644
--- a/ui/src/context/StatusContext.tsx
+++ b/ui/src/context/StatusContext.tsx
@@ -50,10 +50,13 @@ export const StatusProvider: React.FC<{ children: React.ReactNode }> = ({ childr
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action, ...payload }),
});
- if (res.ok) {
- await refreshStatus();
- return await res.json();
+ if (!res.ok) {
+ // Surface non-2xx responses as rejections so callers do not mistake a
+ // failed restart/start for success and emit positive UI feedback.
+ throw new Error(`Control action ${action} failed with status ${res.status}`);
}
+ await refreshStatus();
+ return await res.json();
} catch (e) {
console.error('Control action failed', e);
throw e;
diff --git a/vibe/runtime.py b/vibe/runtime.py
index a28dd882c..f7e111ed8 100644
--- a/vibe/runtime.py
+++ b/vibe/runtime.py
@@ -334,11 +334,16 @@ def write_status(state, detail=None, service_pid=None, ui_pid=None):
now_iso = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
# Preserve started_at across consecutive "running" writes so the UI can
# show a stable service start time. Reset it on transitions in/out of
- # running state.
+ # running state, AND when the service PID has changed (e.g. a forced
+ # restart that goes running -> running but with a new process).
started_at = None
if state == "running":
previous = read_json(paths.get_runtime_status_path()) or {}
- if previous.get("state") == "running" and previous.get("started_at"):
+ if (
+ previous.get("state") == "running"
+ and previous.get("started_at")
+ and previous.get("service_pid") == service_pid
+ ):
started_at = previous["started_at"]
else:
started_at = now_iso