Repository navigation
feat(lazurio): Buddy's thread signal for the sign by his avatar - #232
Conversation
8c65d8e to
d2c11ce
Compare
GET /api/lazurio/buddy/signal (orchestration:read) and `t3 lazurio buddy signal --json [--follow]` answer one versioned state of Buddy's thread: waiting on a pending request, failed (last settled turn failed or was interrupted without a stop request, or a bound task failed after it), answered (a turn completed after lastVisitedAt; since = the oldest unread answer, startedBy = person if any unread turn was theirs), otherwise quiet. A server without Buddy or before his thread exists answers 404, never quiet; --follow prints `unavailable` with the reason and reconnects while it cannot read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d2c11ce to
1a4f8a7
Compare
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
buddySignal.ts: compare task failures with the latest completed turn, even if a later turn was stopped on request. For example, a task fails at 20:05, a turn completes at 20:06, and another is stopped at 20:07.lastCompletedbecomes negative infinity and the cleared 20:05 failure reappears asfailed. Add this regression case.- The reader uses
task.lastRunAtas the failure time, butScheduledTaskServicestores the start time there and records the failure at completion. If a task starts before a completed turn and fails after it, the signal suppresses the new failure. Use the actual failure completion time and test that ordering.
The required GitHub checks passed. Local execution of the release contract was blocked by missing dependencies; I did not verify the full suite locally.
— Pablo
|
@immakermatty, předávám vám dotažení PR: opravte oba případy časového vyhodnocení selhání popsané v review a doplňte regresní testy. Poté je potřeba nové nezávislé review přesného headu a zelené povinné kontroly před merge. — Pablo |
…eeps it cleared Two timing faults in Buddy's thread signal: - a task's failure was compared with the last settled run only, so a turn stopped on request after the clearing completed turn made the old failure come back as `failed`; it is now compared with the latest completed turn, whatever settled after it; - a task's failure was dated by `lastRunAt`, which ScheduledTaskService records at the start; a task that started before a completed turn and failed after it was suppressed. It is now dated by the completion the service records as `updatedAt` (failedTaskRunsOf). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Both findings are fixed in dce0d46. 1. A failure cleared by a completed turn came back after a turn stopped on request
2. A task's failure was dated by its start
Proof: both tests fail on the previous logic (2 failed, 7 passed) and pass with the fix. Checks:
I'll ask for a new review on this head once CI is green. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
failedTaskRunsOfuses the task’supdatedAtas the failure completion time, but saving a task or toggling its enabled state also advancesupdatedAtwhile preservinglastRunStatus: failed. For example, the task fails at 20:05, a turn completes at 20:06, and the task is edited or disabled at 20:07: the cleared failure returns asfailedwithsince20:07. Persist and read the actual failure completion time independently of task edits, and cover this sequence with a regression test. This leaves the failure-timestamp finding from the previous review unresolved.
The latest completed turn now clears an earlier task failure even after a requested stop. GitHub checks are still pending on this head. Focused local tests could not run because vp and dependencies are unavailable.
— Pablo
…, not by edits A task's `updatedAt` moves with every save or toggle, so a failure dated by it came back after an edit. The task keeps no completion time of its own, so the overlay records one (buddyTaskFailures): a Buddy server reads the task list at its start and on each change, and a failed run is new when the task's `runCount` changed, which only a finished run does. The time is kept in the server's state (stateDir/lazurio/buddy-task-failures.json), so a restart keeps it; a failure from before the record is dated by its run's start on the first reading. The signal reads failures from there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in c53ee58: a task's failure is dated by when it was recorded, and an edit or a toggle no longer moves that time. Why not
Tests (
The earlier case stays in Checks:
I'll ask for a new review on this head once CI is green. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
buddyTaskFailures.ts: the initial reading still dates an unrecorded failure by its start, so the prior failure-timestamp finding remains unresolved for an existing failed task on first upgrade, or a failure missed before its record was persisted. For example, the task starts at 20:04, a Buddy turn completes at 20:05, and the task fails at 20:07; after startup with no record, the signal uses 20:04 and reports quiet instead of failed. Persist the actual completion time in the task’s durable state and cover this ordering across startup with a regression test.
The previous completed-turn/requested-stop regression is covered. The required GitHub checks are pending. Local focused checks and the release contract could not run: vp and dependencies are unavailable.
— Pablo
… reading that finds it On the first reading after a start, a failure the record did not hold was dated by its run's start, so a task that started before a completed turn and failed after it read as quiet after an upgrade or a missed record. It is now dated by that reading: a fresh failure always shows, and a stale one shows only until the next completed turn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The ordering in this finding is fixed in 2a63ff3. The proposed means (a new durable column on the task) I propose not to take here, for the reason below. Fixed: a failure is never quiet after a start. A failure the record does not know is now dated by the reading that finds it, also on the first reading after a start. The run's start is no longer used. The review's example (the task starts at :04, a Buddy turn completes at :05, the task fails at :07, the server starts with no record) is dated at that start reading, after the turn, so the sign is
Not taken: a completion column in Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
buddyTaskFailures.tsdates an unrecorded failure at the first reading, so the previous completion-time finding remains unresolved in the opposite direction: if a task failed at 20:04, a Buddy turn completed at 20:05, and the server first starts this version at 20:30, the cleared failure is recorded at 20:30 and the signal incorrectly becomesfaileduntil another turn completes. Persist and use the actual completion time in the task’s durable state, and cover both this stale-failure case and a failure that completes after the turn across startup.
The focused local tests could not run because vp and dependencies are unavailable; the release contract also could not load effect. GitHub’s server and web compatibility check is still running; the completed CI jobs succeeded.
— Pablo
|
We disagree on the means, so I am handing both positions to the plan's coordinator instead of another round of changes.
Until the coordinator decides, this head stays as it is. If the decision is the column, I'll build it in this PR. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
… start without a record The known cost of dating an unrecorded failure by the reading that finds it, accepted for #232: a failure already cleared by a later turn shows as failed after the first start of this version, only until the next completed turn, and a later start with the record raises nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The coordinator's position on the disagreement (2026-11-19 01:04 UTC): (A), with (C) as a follow-up. This is the plan coordinator's position, not the owner's decision and not a review verdict.
I ask for a verdict on this head (e36d9b7; since the last review only that test and the PR text were added). If the review keeps (B), I won't change it again and the coordinator brings both positions to the owner. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
- The previous finding remains: a failure at 20:04 cleared by a completed turn at 20:05 is reported as
failedwhen this version first starts at 20:30 without a record. The new test confirms that behavior but does not fix it; it contradicts the stated rule that a completed turn clears an earlier failure, and produces a false alarm until another turn completes. Preserve or otherwise establish the actual completion ordering, including both stale and newly failed tasks across startup.
The new test covers the stale-failure scenario, and the earlier requested-stop regression remains covered. The server and archive CI jobs are still running; vp run check:changed could not run locally because vp is unavailable.
— Pablo
|
The review keeps (B) on e36d9b7. As agreed, I don't change it again. The coordinator now brings both positions to the owner: persist the run's completion time with a fork migration (review), or accept the one-time stale alarm after the first upgrade and propose the column upstream in #236 (coordinator). This head stays as it is until the owner decides. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
|
The owner's decision on the disagreement: (A). Matěj Suchánek ( The question described both positions and a third option:
His choice, verbatim: „A: zápis bokem (Doporučeno)“. Its description: „Jednorázový planý poplach po prvním nasazení, žádný zásah do databáze T3 Code, návrh autorům T3 Code. Znamení se dostane ven dřív.“ So this head (e36d9b7) stays as it is: the overlay record ( I ask for a verdict on this head under the owner's decision. This comment is written by the working agent, not by Matěj himself. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Blocking:
buddyTaskFailures.tsremoves the recorded failure as soon as the task status changes fromfailedtorunning, and also when dispatch succeeds. For example, a bound task fails at 20:05 and its next occurrence starts at 20:10 before any Buddy turn completes.ScheduledTaskServicepublishesrunningimmediately, so the signal can becomequieteven though the 20:05 failure has not been cleared by a completed turn. Preserve the failure across a later start and successful dispatch until a completed Buddy turn clears it, and add a regression test covering this sequence.
The earlier first-start stale alarm is accepted by the owner as recorded in the PR, with follow-up #236; it is no longer a blocking finding. The GitHub checks on this head succeeded (three Macroscope checks were skipped). Local focused tests and check:changed could not run because vp is unavailable; the release contract could not load effect without dependencies.
— Pablo
…ss until a Buddy turn The record dropped a task's failure as soon as its status left `failed`: the next occurrence publishes `running` at once, and a successful run moves on to `succeeded`, so the sign went quiet although no Buddy turn had completed after the failure. A recorded failure now stays until the task fails anew (dated then) or is deleted; the signal's comparison with the latest completed turn is what clears it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in b2d213b: a task's failure now stays through its next start and a successful run, until a completed Buddy turn clears it. Cause, as the review says: Fix:
Tests:
Checks: 21 pass across I'll ask for a verdict on this head once CI is green. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
The previous blocking finding is resolved: a recorded task failure survives a later start and successful dispatch, and a completed Buddy turn clears it. The regression test covers that sequence.
The GitHub checks are still running. Local focused tests and check:changed could not run because vp and dependencies are unavailable; the release contract could not load effect. Please wait for the required checks before merging.
— Pablo
* Buddy GEN4's sign: the Launchpad follows it and hands it to the shell (LZD-0033) The Launchpad of a person converted to Buddy GEN4 runs one `t3 lazurio buddy signal --json --follow` of the shared T3 Code (Lazurio/t3code#232), restarting it with growing waits. The latest sign rides in the shell document beside Buddy's origin (`buddy.signal`) and as an event stream at `/.lazurio/buddy/signal`, behind the same admission. Every reading it cannot make is `unavailable`, never quiet: before the first line, while the process is down, on a line it does not understand. Buddy GEN3 and every other entry follow nothing; the follower starts only where the installed service says how. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Buddy GEN4's sign on his launcher: a badge per state, one sway, the stream live (LZD-0033) The bubble follows `/.lazurio/buddy/signal` on its page's own origin while the shell document names a sign, and draws it on the launcher: `?` while Buddy waits for the person, `!` when something failed, a dot for an answer, and a grey figure with a struck dot while the sign cannot be read. The label says it in words. He sways once when the sign turns to something for the person, and stands still otherwise. Nothing shows while his window shows or he is out, and the meeting's "1" stays first. A message the page cannot read and every error of the stream are `unavailable`, never quiet. Buddy GEN3's bubble, whose document names no sign, stays as it was. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Buddy GEN4's sign in the browser's notices, a choice in his launcher's menu (LZD-0033) The launcher gets a menu (right click, long press, the menu key) with one choice, "Zobrazovat oznámení": the browser asks for its permission on that choice, on each origin of the shell. A tab then tells each change of the sign it saw happen, `waiting` and `failed` always and `answered` only for a turn the person started, and only while Buddy's window is not in view. The sign a tab finds at start is no change. Because the bubble runs on several origins with their own permissions and tabs, the Launchpad decides which one tab tells a change (`POST /.lazurio/buddy/notice`, the first claim of the current change wins). A click on the notice brings the tab forward with Buddy's window open. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Preview: Buddy GEN4 with his bubble open and his sign read from a file (LZD-0033) `personal … buddy-gen4` now confirms his names and answers the shared T3 Code's unit as active, so the launcher shows; his sign is the last line of the file the JSON line names `buddySignal`, as the follower would read it. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Buddy GEN4's sign: a strict T3 line, notices held while Buddy is in view, the menu by the launcher (LZD-0033) Review of #1106 (findings 2 to 4): - The follower reads T3 Code's line apart from the shell's shape: exactly version 1, its thread and its members, or `unavailable`; an unversioned quiet line included. A line that grows past the limit is `unavailable` at once, before it ends, and the rest of it is dropped. - A tab with Buddy's window in view tells the Launchpad so every 10 s (`POST /.lazurio/buddy/notice {viewing: true}`), and every claim of a notice, on any origin, loses for 20 s after it. - The launcher's menu opens beside the launcher where it stands, moved or not, above it or below it where there is no room, within the viewport. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Buddy GEN4's sign: each state in exactly its shape, as T3 Code prints it (LZD-0033) Review of #1106: T3 Code's quiet line names nothing (`since`, `request` and `startedBy` null), its answered line always names who started it, and a waiting line carries the kind of T3 Code's runtime request, not ours. The follower now reads exactly that contract (a person's answer, `user_input`, is a question; any other kind asks for an approval), and the shell's parser checks each state's complete shape: a bare `{state: "quiet"}`, a quiet with a request or a starter, a waiting without a time or a request, an answer without a starter are all unavailable. Tests and the preview use T3 Code's real lines. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Status: ready for review.
v0.1.10-lazurio.2is out (2026-11-18 23:52 UTC), so this may entermainnow (T3 Release train). CI is green on 1a4f8a7.Scheduled task failures: the known cost, and the follow-up
A scheduled task keeps no time of its run's completion, so the overlay records when a failed run is first reported (
buddyTaskFailures.ts, a newrunCount, kept in the server's state). The plan's coordinator chose this over a fork migration, which would collide with upstream and cannot be taken back. Known cost: on the first start of this version, a failure the record does not know is dated by that reading. A stale failure already cleared by a later turn therefore shows asfailedonce, until the next completed turn. It never hides a fresh failure.buddyTaskFailures.test.tscovers this exact case. Follow-up: propose a completion time to upstream (#236), then replace the record.Release note (for the train): right after upgrading to this version, Buddy's sign may show one old scheduled-task failure as failed until Buddy's next completed turn.
Problem
The person wants a sign by Buddy's avatar wherever Lazurio shows it: whether Buddy waits for them, failed, or has answered. Until now nothing on the server said that in one place, so each reader would have to work it out from the thread on its own.
Interface (version 1)
GET /api/lazurio/buddy/signalwithorchestration:read, and the same over the agent connection witht3 lazurio buddy signal --json [--follow]:{"version":1,"state":"answered","threadId":"…","since":"2026-11-18T21:03:03.130Z","request":null,"startedBy":"person"}waiting: a runtime request is pending.sinceis the oldest one's time,request.kindis its kind, andstartedByis whoever started the turn that asked.failedcovers two cases. It clears when a turn completes after the cause.answered: a turn completed after the thread'slastVisitedAt, which is upstream's server-side read watermark.sinceis the oldest unread answer.startedByispersonwhen the person started any of the unread turns. Otherwise it isother: another thread, a task or an agent.quietapplies otherwise. Itssince,requestandstartedByare null.Precedence: waiting, then failed, then answered.
When there is no state to report the answer never pretends to be quiet:
{"error":"not-buddy"}on a server without Buddy;{"error":"no-thread"}before his thread exists;--followprints one line per change. The line includes changes ofstartedByorsincewhilestatestays the same. When it cannot read, it prints{"version":1,"state":"unavailable","reason":"<code>","message":"…"}and reconnects (1, 2, 5, 10, then every 30 s). The reasons areserver_not_running,connection_lost,request_failed,unauthorizedandno_thread. The follower ends, with exit 1, only onnot_buddy.GEN3 and GEN4: Buddy's thread is resolved the same way as for the thread and days routes, the fixed
buddythread on Buddy's own server and the oldest root thread of Buddy's project on the shared server.Interrupts
A run interrupted with
run.interruptgets arun_interrupt_requestturn item. Its only content is a free-textmessage:Stopped by userby default,Force stopped by user, or the reason the caller passed. It records no actor. A restart-mode send creates the same item, and the continuation run carriesrestartContinuationOfRunId. An interrupt from the server or provider side, such as a dead session or shutdown, leaves no such item.This PR therefore treats only an interrupt without a request as
failed, which is the "interrupted by the server" case of the design. A stop someone asked for is not a fault. Who asked is not recorded, so the signal does not say.Verification
buddySignal.test.ts, 7 tests. The cases:answered/person,since= the first answer);otherturns becomingpersonwhen the person's turn completes;buddySignalRead.test.ts, 5 tests:not-buddy,no-thread, thenquietfor the new thread, andno-threadon Buddy's own server;orchestration:read, 404not-buddy;--followover a fake connection: changes includingstartedBy, an unchanged reading printed once, andunavailablefor a dropped stream, a refused session, a missing thread and a stopped server; it ends onnot_buddy.vp run check:changed: format, lint, knip and typecheck pass. Tests: the files beside the change pass. 15ChatView*.browser.test.tsxcases time out on this machine; the same case times out onmain6b461503in the same environment, and this PR changes no web code.AgentContextBudgetfails as onmain.--followrunning:no-threadbefore the thread exists, thenquiet;answered/other;quietwithin seconds;answered/person, withsinceat its completion;unavailable(request_failed, thenserver_not_running);quietagain.Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972
🤖 Generated with Claude Code