mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 17:47:39 +01:00
feat/parallel-implement
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e3d9024887 |
fix(orchestration): a closed run tells the thread what the agent actually did (#772)
Both close notifications — the outcome turn in /loki and the push/Telegram message — read only `payload.resultText`. The hosted runner and openclaw set it. The local PTY path, which is the one a person watches after typing into /loki, does not: it closes from the agent's session handoff, and the agent's own words land in `summary`. So the main path reported "🟡 **loki** — partly done." and nothing else. The agent had written `done: e2e ok — no changes`, the judge had written exactly what it found missing, and none of it reached the thread — which is the trip out of the product this message exists to prevent. One shared `runReportText` now answers "what did the agent say", preferring a runner's own result text and falling back to the handoff: `done`, plus `next` when it holds something, because on anything short of success `next` carries the definition-of-done gap and the gap is what the operator must act on. And the live check stops asserting what its own prompt forbids. The probe says do NOT change a file, commit, or open a pull request; the judge then correctly grades the run partial for having no committed change; the check demanded a ✅ and so failed on a perfect run (2026-09-17, run 69cdbdb7: injected 11:56:11, handoff "e2e ok — no changes" thirty-two seconds later, every leg working). It now asserts the thing that actually proves the loop — the agent's own handoff summary coming back into the thread — and still fails on ❌ or on a turn that carries somebody else's words. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
caa0e41c3b |
chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes singleQuote=false was chosen by counting this repo's own imports, not by fleet decree. The fleet is genuinely split and the two repos that already had a .prettierrc disagreed with each other, so there was no standard to restore. Quote style does not cross repo boundaries; having a gate does. Markdown is ignored for now — prettier rewraps prose, which would bury the real diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style: format with prettier (1062 files) Mechanical. No behaviour change. This SHA is listed in .git-blame-ignore-revs so `git blame` skips it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore: teach git blame to skip the reformat Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(lint): reattach two guards the reformat detached Both effects were one-liners, so a trailing eslint-disable-line covered the setState call: useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ... prettier expanded the block. The comment stayed on the closing line while the call moved above it, so the guard protected nothing and the rule its author had deliberately silenced failed the build. This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line variant. Both come from the same fact: an eslint directive binds to a line number, so reformatting can silently unbind it, which makes 'mechanical, no behaviour change' false for any bulk reformat. * chore(desktop): bump the runner version the reformat requires desktop-release-drift enforces that anything built into Fleet Runner which differs from the last released tag must carry a version ahead of that tag — main read 0.8.15 and fleet-runner-v0.8.15 already shipped. A whole-repo reformat changes bytes under desktop/, so the gate fires. The alternative was adding desktop/ to .prettierignore, which would buy a quiet PR by carving a permanent hole in the formatter's coverage — the precise shape of silent drift this test was written to catch. Bumping is what the rule asks for and costs one patch release whose only content is whitespace. * chore: merge main and re-format A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR runs no checks at all while reporting nothing. Conflicts resolved to main, which is correct because this branch changes formatting and nothing else. * chore: leave desktop/ out of this reformat desktop-release-drift is right to refuse this. Everything under desktop/ is built into Fleet Runner, so changing it means shipping: bump the version AND add a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed Fleet Runner and wants to know what changed'. For a whitespace-only build the honest answer is 'nothing', so that release should not exist — and I should not write release notes claiming otherwise. I had bumped to 0.8.16 to get the gate green. That was the wrong direction: publishing a build to three OS runners to keep a formatting PR quiet. Reverted. desktop/ is excluded in .prettierignore with the reasoning recorded there, to be formatted alongside the next real runner change, where the bump and the notes are true anyway. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
4013d7c686 |
fix(orchestration): the reaper announces its verdicts — failure stops being the quiet outcome (#340)
A run that SUCCEEDS told the operator. A run that DIED said nothing. updateOrchestrationRun is the funnel every normal close goes through, and it fires notifyRunClosed on ANY close (line ~82). The reaper closes stale runs with a raw UPDATE that bypasses that funnel entirely. It already knew to re-implement one side effect there (advanceEscalation, for the ladder) — but not the notification. So the single outcome the operator most needed to hear about was the only one the product kept to itself. Measured cost of that asymmetry, in prod today: five visitor-feedback items on orangecat had been sitting "dispatched" for up to a month — Jul 27, Aug 2, Aug 7, Aug 13 x2 — across three runs the reaper had stamped `timeout` an hour after dispatch. All three were DELIVERED (the prompt reached an agent), so this was not a dispatch failure; the agents just never closed. Nobody was ever told, so the inbox looked busy while the loop was dead. - cleanupStaleOrchestrationRuns now calls notifyRunClosed for every reaped run, alongside the escalation-ladder advance it already did. - .returning() widened to full rows (notifyRunClosed needs payload + finishedAt, not just the reap bookkeeping columns). Both existing consumers read only id/userId/outcome, so this is additive. - Deliberately NOT resolveFeedbackForRun: that helper resolves unconditionally and the reaper never stamps success — calling it would mark feedback "shipped" because its fix run died. The comment in the funnel now says which half of its assumption still holds. Not a new noise source: formatRunCloseMessage returns null unless payload.notifyOnClose is set, which only human-initiated dispatches carry, so autopilot churn stays silent. Verified zero open runs at ship time, so the first sweep cannot produce a backlog storm. Test pins the invariant (scripts/test/notify-close.ts): a reaper `timeout` verdict must produce a message carrying its reason. Proven by mutation — making the formatter success-only exits 1 with "timeout must produce a message, got: null"; green when restored. Co-authored-by: t <t@t.t> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
feb998a221 |
feat(dispatch): tell the operator their dispatch finished (#321)
Clicking Send and hearing nothing back is the complaint. The machinery to answer it was fully built and switched off, in three independent places. 1. NOTHING EVER SET notifyOnClose. It is plumbed through /api/inject, stored on the run payload, formatted by a pure unit-tested function — and the only caller that ever set it true was a test fixture. Every dispatch declined to announce itself. 2. THE ONE CHANNEL IT WOULD HAVE USED IS UNCONFIGURED. notifyRunClosed sent via Telegram and returned early when selfTelegramTarget() was null. In production TELEGRAM_BOT_TOKEN is set and TELEGRAM_CHAT_ID is not, so even an opted-in run would have gone nowhere, silently. 3. WEB PUSH IS WIRED TO NOTHING. VAPID keys are configured, the service worker, the subscribe route, the NotificationsPill and the use-push-subscription hook all exist — and the only consumer of the send path is the HTTP endpoint itself. The operator's installed PWA could be reached and never was. So: notifyRunClosed now delivers on EVERY configured channel rather than the first one that happens to exist, push included — the channel that actually reaches the phone of someone who dispatched and pocketed the device. The fan-out is extracted to lib/push-fanout.ts so a server-side caller does not self-HTTP its own API (same reasoning that pulled inject-core out of the route), and it reports WHY nothing was sent: "not configured" and "no subscriptions" need opposite fixes and a silent zero looks identical for both. A run that opted in and reached nobody is logged as the product failure it is. WHO GETS TOLD is the interesting decision. "UI dispatches stay silent so the fleet's normal churn never spams the phone" was protecting something real, but it assumed a UI dispatch means the operator is watching Control. They are not — they dispatched and walked away, which is the entire point of an always-on builder. The honest split is human vs machine, and that is knowable without a heuristic: getApiActor reports HOW the request authenticated. A cookie session is a person; a Bearer token is a runner, a hook, or a scheduled loop. Autopilot stays silent, a click gets an answer, and an explicit value still wins in either direction so chat can opt in and a noisy loop can opt out. The rule lives in notify-close-format.ts (pure, shared) rather than inlined at both dispatch routes, which is where it was about to become two copies that drift. Negative-tested: disabling it reproduces the shipped silence. Also fixes a source-level guard it tripped: autopilot-defaults asserted /api/inject contains the literal "getApiUserId" to prove the route still accepts a runner Bearer token. getApiActor delegates to it and satisfies the same property, so the assertion now checks the invariant instead of the name. Co-authored-by: t <t@t.t> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
1cfef1e91e |
feat(chat-seam): approve-from-chat + chat dispatch outcomes (#251)
Two seams that make Loki (OpenClaw) a first-class operator surface: - POST /api/actions/[id]/decision — approve/reject a queued action with a ck_* bearer token. finalizeApproved extracted to lib (SSOT shared with the Approvals page server actions), so chat and UI approval cannot drift. - GET /api/actions/pending — the read half: chat can enumerate the queue. - notifyOnClose: chat-originated dispatches (via /api/inject) opt into a Telegram push when the run closes, wired at the updateOrchestrationRun choke point + the closeRunUndelivered bypass. Message logic is pure (notify-close-format.ts) with unit coverage. Co-authored-by: test <test@test> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |