Skip to content

feat(lazurio): Buddy's hidden window no longer marks his answers seen - #240

Merged
immakermatty merged 3 commits into
mainfrom
lazurio/buddy-window-shown
Nov 20, 2026
Merged

immakermatty merged 3 commits into
mainfrom
lazurio/buddy-window-shown

Conversation

@immakermatty

@immakermatty immakermatty commented Nov 20, 2026 •

Copy link
Copy Markdown

Status: ready for review. The F60 addendum that adds lazurio.buddy.shown to the protocol lazurio.buddy.* v1 is decided (Matěj's consent of 2026-11-20, see the comment below). The Platform side is Lazurio/LazurioPlatform#1123. This goes into 0.1.10-lazurio.4.

Problem

The sign by Buddy's avatar (#232) never said answered after the person only closed Buddy's window and stayed on the page. The Lazurio shell keeps Buddy's frame alive inside the closed window (F60 point 3). The chat view mounts ThreadVisitWatermark, which counts a mounted view as the person looking, so every answer that came while the window was closed advanced lastVisitedAt. The server's sign reads answered only for a run completed after lastVisitedAt. The hidden frame therefore read the answer first.

Change

  • lazurio.buddy.shown v1 (buddySurfaceProtocol.ts): {type: "lazurio.buddy.shown", v: 1, shown: boolean}, from the host to the frame. It is taken only from the parent on exactly the host's origin, as the context is, and any defect drops it whole.
  • The frame (buddySurfaceFrame.ts, useBuddyFrame.ts) keeps what the host said last. The value is null until the host says anything.
  • The chat view (ChatView.tsx, through useBuddyWindowInView) mounts the visit watermark in a host's frame only once the host says the window is shown. This also holds for a frame loaded anew behind a closed window: until the host answers, nothing is counted, so an unread answer stays unread. Whether a host frames the page is read from the window itself (buddyHostOfWindow), so this holds from the first render, also while the Buddy config is still loading. When the window shows, the watermark mounts, records the visit, and the sign turns quiet.
  • Older Lazurio: a host that sends its context without shown before it never says, so the frame then behaves as before. The newer Lazurio sends shown before the context (Buddy: the frame hears whether his window shows it (lazurio.buddy.shown; proposed F60 addendum) LazurioPlatform#1123). An older T3 Code drops the unknown message, so an older T3 Code with a newer Lazurio behaves as before too.

Verification

  • buddySurfaceFrame.test.ts:
    • a frame loaded anew behind a closed window counts nothing before the host answers, nor after shown: false and the context. This is the regression from Pablo's review of 5a47a66c, and it fails with the earlier rule;
    • a message from another origin or another window changes nothing;
    • shown: true: seen;
    • an older host, whose context comes without shown: seen, as before;
    • outside a host's frame: seen, as before.
    • before the config is known, the window alone says a host frames it, and nothing counts until shown: true. This is the regression from Pablo's review of 5d321f0b.
  • buddySurfaceProtocol.test.ts: the message is taken from the parent on the host's origin, and dropped for another window, another origin, no host, a non-boolean shown, v: 2, an extra member, or a context message.
  • vp run check:changed:
    • format, lint, knip, typecheck and React compiler pass;
    • the changed unit tests pass;
    • ChatView*.browser.test.tsx time out on this workstation, and do so without this change as well. The test environment's /api/orchestration/shell answers 404 here. CI runs them.
  • The server side is unchanged: a completion after lastVisitedAt already reads answered.

Not verified yet

  • Real client. Buddy's frame takes messages only from a Lazurio host origin (launchpad|t3code|mausbot.<base>.lazurio.io), so the real-client pass is the live acceptance as Bob with the release that carries this change and the Lazurio candidate with feat(desktop): add manual "Check for Updates" button in web settings pingdotgg/t3code#1123. In a real browser with the Platform change: open Buddy's window, send a message, close the window on the same page; the answer comes and the sign says answered. Opposite case: with the window shown, nothing.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

The host tells Buddy's frame whether its window is shown
(lazurio.buddy.shown v1). While the window is hidden the chat view does
not mount the visit watermark, so an answer that comes then stays
unread and the sign by Buddy's avatar says answered. A frame that never
hears the message (an older Lazurio) behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty

Copy link
Copy Markdown
Author

Consent recorded. Matěj (Organization Admin) consented to the F60 addendum of 2026-11-20 (lazurio.buddy.shown) and to this change on 2026-11-20. He answered in the question tool of the coordinating thread BUDDY GEN4 (T3 thread 1ef5b961-fc27-4da5-b1f2-ba634a207477), which passed his answer on at 11:35 UTC.

The question described:

The choice he took: this thread records his consent in both changes, Pablo reviews them, a new Chat release follows, and the sign is accepted again on Bob.

The addendum's text did not change in substance from d107528b; only its first line now records the decision.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

@agentrozjedemeai

Copy link
Copy Markdown
Collaborator

@immakermatty, I am handing this PR back to you. Head 5a47a66c1db40f37d1ef1a5c1f8344c22bd608f7 has no independent approval yet. Please arrange an independent review of that exact head and the real-client verification, then merge only after the required gates pass. The required GitHub checks are green; my local check:changed passed format, lint, knip, typecheck and React compiler, but its browser tests could not start because the required Chromium executable is absent. The project’s built-in browser verification tools are unavailable in this session. The paired Platform change is still open: Lazurio/LazurioPlatform#1123; its end-to-end acceptance is recorded for the release.

— Pablo

@agentrozjedemeai agentrozjedemeai removed their assignment Nov 20, 2026

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking:

  • Prevent ThreadVisitWatermark from mounting in a hidden Buddy frame before the visibility handshake completes, while retaining the agreed fallback for older hosts. On a reload of an already hidden frame, shown starts as null and buddyWindowInView treats that as visible; the host only replies asynchronously after ready. If the thread shell is available first, mounting the tracker immediately records its updatedAt, including a completed answer, and the later shown: false cannot undo that visit. The answered sign can therefore disappear without the person opening the window. Add a regression covering a hidden frame reload with an unread completion and the subsequent host reply.

Non-blocking: The paired Platform change is still open and its own review requests a fix. Local format, lint, knip, typecheck, React compiler and 73 unit tests passed; browser tests could not start here because Chromium is absent. Real-client acceptance remains open.

Order and migrations: The paired Lazurio/LazurioPlatform#1123 and a T3 Code release containing this change are needed before live acceptance of the answered sign; either PR can merge first.

— Pablo

…ore counting a visit

In a host's frame the thread counts as seen only once the host says the
window is shown. Before that, a frame loaded anew behind a closed window
could record a visit, and a completed answer with it, before the host's
shown: false arrived. A host that sends its context without shown first
(an older Lazurio) still counts as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 20, 2026
…o visit until the host shows it

T3 Code's frame (Lazurio/t3code#240, after Pablo's review of 5a47a66) now
counts a visit only once it hears shown: true, and takes a context
without shown before it for an older host's. The host therefore sends
shown before the context after every ready. The F60 addendum says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty

Copy link
Copy Markdown
Author

Fixed in 5d321f0b.

The fix. In a host's frame the thread now counts as seen only once the host says shown: true:

buddyWindowInView(framed, shown, heardContext) = !framed || shown === true || (shown === null && heardContext)

A frame loaded anew behind a closed window therefore mounts no watermark before the host answers. The visit cannot be recorded before shown: false arrives.

The fallback for older hosts stays: a host whose context comes without shown before it never says, so the frame counts as before. Lazurio/LazurioPlatform#1123 (b691867d) now sends shown before the context after every ready, so a newer host never hits that fallback. Its test checks the order.

The regression (buddySurfaceFrame.test.ts): a frame loaded anew while hidden counts nothing before the host answers, nor after shown: false and the context; it counts once shown: true comes. A second case covers the older host. The first fails with the earlier rule.

Checks: vp run check:changed passes format, lint, knip, typecheck and React compiler, and the changed unit tests pass. ChatView*.browser.test.tsx time out on this workstation with or without this change, because the test environment's /api/orchestration/shell answers 404 here.

Real client: the frame takes messages only from a Lazurio host origin, so the real-client pass is the live acceptance as Bob with the release carrying this and a Lazurio candidate with pingdotgg#1123. The description records it as not verified yet.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking:

  • Keep ThreadVisitWatermark unmounted until the Buddy configuration is known as well as until the host's visibility reply arrives. useBuddySurfaceMode can be null while the config loads, but useBuddyWindowInView passes false to useBuddyFrame in that state, so framed is false and the watermark mounts. On a reload at Buddy's thread URL, a cached shell can render the thread before the config arrives; its tracker immediately attempts a visit and may retry when the session connects. That can mark an unread completion seen before shown: false is processed, reproducing the defect. Cover this ordering with a regression that holds the config back, loads the hidden frame with an unread completion, then delivers config and the host reply; retain the older-host fallback.

Non-blocking: check:changed passed format, lint, knip, typecheck and React compiler, and 74 unit tests passed. Its browser tests could not start here because the required Chromium executable is absent. The required CI jobs were still pending at review time; real-client acceptance with the paired Platform change remains open.

Order and migrations: Lazurio/LazurioPlatform#1123 and a T3 Code release containing this change are needed before live acceptance; either PR can merge first.

— Pablo

…the config is known

Whether a host of the bubble frames the page is read from the window
itself, without side effects, so the visit watermark stays unmounted in
Buddy's hidden window also while the Buddy config is still loading.
The frame starts there at once and hears the host's shown from the first
render (Pablo's review of 5d321f0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty

Copy link
Copy Markdown
Author

Fixed in 41cc42f2. Whether a host of the bubble frames the page no longer depends on the config. buddyHostOfWindow(window) reads it from the window itself (parent, ancestor or referrer), without side effects. useBuddyWindowInView uses it from the first render, and starts the frame where a host frames the page, so the frame hears the host's shown before the config arrives. A reload at Buddy's thread URL with a cached shell therefore mounts no watermark until the host says shown: true. The older-host fallback stays: a context without shown before it.

The regression is in buddySurfaceFrame.test.ts, "counts nothing in a host's frame before the config is known, then only once the host shows it". It checks, in order:

  1. The window alone says a host frames it, and nothing is posted before the frame starts.
  2. With no config and no reply, nothing counts.
  3. The frame starts, and shown: false and the context arrive: still nothing counts.
  4. shown: true arrives: the thread counts.
  5. A page no host frames counts as before.

The ordering lives in the hook, and a hook-level browser test does not start on this workstation (see below). So the test pins the decision the hook now makes from the window.

Checks: vp run check:changed passes format, lint, knip, typecheck and React compiler, and the changed unit tests pass. The ChatView*.browser.test.tsx failures here are the workstation's own (/api/orchestration/shell 404), with or without this change.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: None. The earlier finding is resolved: the host frame is detected before configuration loads, so the watermark waits for the visibility handshake; the older-host fallback remains.

Non-blocking: Local check:changed passed format, lint, knip, typecheck and React compiler, with 75 unit tests passing. Its browser tests could not start because the required Chromium executable is absent. CI is still running; real-client acceptance as Bob remains open.

Order and migrations: The paired Lazurio/LazurioPlatform#1123 and a T3 Code release containing this change are needed before live acceptance; either PR can merge first.

— Pablo

immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 20, 2026
…wn; proposed F60 addendum) (#1123)

* Buddy: the frame hears whether his window shows it (lazurio.buddy.shown, proposed F60 addendum)

The host tells Buddy's frame after its ready and on every open and close
whether the window shows it, so that T3 Code records no visit while the
window is hidden and an answer that comes then shows by the launcher.
The frame stays alive inside a closed window (F60 point 3). A browser
test drives the real bubble and element in headless Chrome. The F60
addendum waits for Matěj's consent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* F60 addendum of 2026-11-20 decided: Matěj's consent passed on by the coordinating thread

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy: a frame hidden behind his hello hears it is not shown

The window shows the frame only after the meeting; before it the window
holds his hello and the frame stays hidden. shown is now the window
open and no meeting, so a hidden frame never hears shown: true. A
regression covers the frame existing, the meeting returning, the hello
opening and the meeting ending (Pablo's review of 2789f01).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy: shown goes before the context, so a frame loaded anew counts no visit until the host shows it

T3 Code's frame (Lazurio/t3code#240, after Pablo's review of 5a47a66) now
counts a visit only once it hears shown: true, and takes a context
without shown before it for an older host's. The host therefore sends
shown before the context after every ready. The F60 addendum says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy: a frame loaded anew behind his hello hears its ready answered, hidden first

While the meeting shows his hello, the bubble ignored every message of
the kept frame, its ready included. A frame loaded anew there never
heard shown: false, and ending the meeting with the window closed sent
nothing more. Its ready is now answered with shown and the context; it
still asks for nothing until the meeting ends (Pablo's review of
611bc4c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy: every context goes after the frame's current shown

A hidden frame loaded anew could hear a context before the host handled
its new ready, without shown before it, and T3 Code takes such a context
for an older host's. shown now goes right before every context, except
the one that answers a ready, where it just went (Pablo's review of
c14ead1). The F60 addendum says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty merged commit b05167a into main Nov 20, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants