Repository navigation
feat: built-in self-healing for atr serve - #98
Merged
Merged
Conversation
Serve now re-queues a dead running task once (then needs_attention), settles waiting tasks with a sealed summary.md, prunes stale worktrees/slots/dead lock files, and writes ~/.local/state/atr/health.json. Retry already unconsumes the last run so atr retry actually dispatches. Co-authored-by: rimusz <rimusz@users.noreply.github.com>
Default lock_files is only ~/.local/state/m1-runner.lock. Remove a lock only when its PID is dead and the file is older than stuck_timeout; a live PID is kept. Append each FAIL/recovery notify line to health.log and rotate near 1 MiB. Co-authored-by: rimusz <rimusz@users.noreply.github.com>
In-process health was FAILing listen because doctor probed /health then treated our own bind as a foreign occupant. Serve, MCP and Telegram doctor now mark listen Held. CLI atr doctor still probes. A live agent kill stays outcome=failed; the reaper is for serve orphans. Co-authored-by: rimusz <rimusz@users.noreply.github.com>
cargo update -p url (and form_urlencoded 1.2.3). Patches nested blob: Url::origin() stack overflow. Leave the stale RUSTSEC-2024-0436 ignore. Co-authored-by: rimusz <rimusz@users.noreply.github.com>
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.
Adds a deterministic self-heal loop inside
atr serve. No LLM and no extra daemon.What it does
stuck_timeout, are re-queued once (outcome=reaped). A second death becomesneeds_attention. Skips inflight, live PIDs, TUIcli-*and held runs. A live agent kill while serve is up is still a supervisoroutcome=failed; that's documented.waitingrun with a sealedsummary.mdbecomesdone.~/.local/state/m1-runner.lock(only when its PID is dead and the file is older thanstuck_timeout), and optionalprune_dirs.check_interval(5m) it runs an in-process doctor (listen usesListenCheck::Held, no self-HTTP) and writes~/.local/state/atr/health.json,health.txtandhealth.log(rotated at about 1 MiB), all atomically.[notify]command fires on FAIL and on recovery only, de-duplicated (ATR_ALERT_KIND=selfheal_failed|selfheal_recovered).atr selfheal status [--json], aselfheal:line inatr status, and dashboard JSON. Config lives under[selfheal]with safe defaults.atr retryalready unconsumes the run; a regression test was added.Live proof (2026-11-23, Dubai time)
Both runners are on
63c9add, with the v0.1.53 binary kept as a backup.fmt, clippy
-D warningsandcargo test --allare green.cargo denywas not run locally.Models: Grok 4.6 planned and implemented (the Opus and GPT quota was exhausted).
Merge and release need Rimas's OK.