Skip to content

fix(assistant): one opening message, decided once the status has settled - #4735

Merged
vybe merged 1 commit into
devfrom
fix/1356-assistant-first-message
Nov 23, 2026
Merged

vybe merged 1 commit into
devfrom
fix/1356-assistant-first-message

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Fixes abilityai/trinity-enterprise#1356 (private tracker; closed by hand at release).

Cause

On a newly set-up instance the assistant panel's first status read arrives while the instance's account report is still pending, so it carries no opening line from Trinity. The panel then wrote its own hello at once (store.welcome(hello()) in AssistantWidget.vue). That hello is the leftover: the settle re-read a moment later brought Trinity's opening line, and greet() put it in the hello's place (stores/assistant.js). Before both, the empty panel's static words showed while the fleet was read, so a new person saw up to three openings in the first seconds.

The cause is in the platform frontend, not the backend module or Trinity's opening.

Fix

  • AssistantWidget.vue: the opening is decided once. That happens after the reads the hello is written from have come back (fleet, example agents) and after the status has settled (openingDecided). Until then the panel shows a skeleton (aria-busy, design-system recipe), not a message or a starter menu.
  • stores/assistant.js greet(): a line already on screen (same key or text) is not added again. A reload or a second sign-in that hears the same line shows it once.

Tests

  • New describe('one opening, decided once') in tests/unit/assistantWidget.mount.spec.js (3 tests). Each test records every opening the panel shows at each step: mount, open, and through the whole settle back-off. It does this on first open, on reload and on a second sign-in, and asserts exactly one distinct opening in each case: Trinity's line, the panel's own hello, or the panel's static words.
  • Updated one existing test. It pressed a starter during the settle re-read. Starters now wait with the opening, so it pins that none is offered and that a typed message is still held.
  • Mutation check: with the widget change reverted, all 3 new tests and the updated one go red. With the greet() dedupe reverted, the reload case goes red (two copies of the same line).
  • assistantWidget.mount.spec.js: 100/100. Assistant-related specs plus the raw-colour, loading-gate and source-text ratchets: 62 files, 1334/1334. The full frontend unit suite did not finish inside the local time budget; CI runs it.

🤖 Generated with Claude Code

…led (abilityai/trinity-enterprise#1356)

Cause: right after setup the panel's first status read arrives while the
instance's account report is still pending, so it carries no opening line
from Trinity. The panel wrote its own hello at once (store.welcome from
AssistantWidget.hello()), and the settle re-read a moment later brought
Trinity's line, which greet() put in the hello's place. Before both, the
empty panel's static words showed for the length of the fleet read: three
openings in the first seconds.

Fix: the panel decides its opening once the reads it is written from are in
and the status has settled; until then it shows a skeleton, not a message or
a starter menu. greet() no longer adds a line already on screen, so a reload
or a second sign-in that hears the same line again shows it once.

Tests: assistantWidget.mount.spec.js "one opening, decided once" (3 new)
records every opening shown across first open, reload and a second sign-in.
Reverting the widget change turns all three red (plus the updated hold test);
reverting the greet() dedupe turns the reload case red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability

Copy link
Copy Markdown
Contributor Author

PR Validation — APPROVE

Head validated: fe09a3161 · Lane B (frontend only, no schema) · validator run is independent of the authoring run.

Independent probe (my own spec, run against the head, not committed)

I mounted the panel with a status mock I could steer and recorded every opening it showed at each step. Each run covered mount, open, and the full settle back-off plus 30 s timeouts. Each scenario was repeated for first open, reload and a second sign-in where noted.

Probe Result
Slow status (3 s per read, pending → settled with Trinity's line): first open, reload, second sign-in ✅ exactly one opening each time; skeleton first, then gone
First status read fails (500) ✅ error + Retry only, no hello; after Retry, Trinity's line alone
A settle re-read fails mid-way ✅ one opening (see warning 1)
Status settles at once, agent list 6 s slow: first open + reload ✅ the panel's hello once, only after the list arrives
Status never settles (always pending) ✅ skeleton ends after the back-off (~7.5 s); hello once
Never settles and every re-read times out at 30 s ✅ skeleton still ends (bounded at ~2 min worst case by the 30 s client timeout)
Status never answers at all the existing pre-status skeleton (unchanged by this PR), bounded by the 30 s client timeout → error + Retry
After Trinity's line: a starter, then a typed message ✅ starter sends a turn; typed message sends
After the panel's hello: starters shown, typed message ✅

Mutation: with AssistantWidget.vue reverted to the base, the PR's 3 new tests and my 6 probes go red. With only the greet() dedupe reverted, the reload case goes red. That matches the PR body.

What a person sees if the status never settles: the two-line skeleton (aria-busy) for at most the back-off (~7.5 s, or longer only if each re-read hangs to the 30 s timeout), then the panel's own hello. It never stays forever. Every read it waits on (loadStatus, refreshFleet, firstRun.fetchState) swallows its error, and the client has a 30 s timeout.

CI

  • Full frontend unit suite (frontend-build → npm run test:unit, same head SHA): 575 files, 8645/8645 passed (215 s). This covers the run the author could not finish locally.
  • Required contexts (CodeQL ×2, schema-parity, verify-non-root), secret-scan, journey-impact, frontend-e2e: green.
  • pytest (head, seed 12345) / regression diff: still running at validation time. The PR touches no backend file, but the merge should wait for it to finish green.
  • Locally: assistantWidget.mount.spec.js + raw-colour, loading-gate and source-text ratchets: 4 files, 128/128.

Checklist

Closing keyword ✅ Fixes abilityai/trinity-enterprise#1356 (cross-tracker → set status-in-dev by hand after merge)
Journey Impact ✅ script PASSED (no declaration; allowed)
Security greps / file modes / host paths ✅ none
Audit rows / config / packaging / cross-surface ➖ frontend only
Execution coverage ✅ the new tests mount the real component and drive the store, so they execute the changed path. None of the assertions read source text.
Merges into current dev ✅ clean (git merge-tree)
Structural /review ⚠️ not run on this branch; this report does not cover a structural pass

Warnings (non-blocking)

  1. Blank frame after a failed re-read. The new skeleton is hidden when store.statusError is set. The InlineError only renders while !store.status. So when a settle re-read fails (status already present), the conversation area is empty: no skeleton, no error. It stays empty until the next re-read, about 1 s later in my probe. Keeping the skeleton there (drop && !store.statusError from the pending branch, since store.status is known to be set inside the v-else) would close it.
  2. The skeleton bars use bg-gray-200 dark:bg-gray-700, while the pre-status skeleton a few lines above uses bg-gray-100 dark:bg-gray-750. Gray passes the ratchet, but the two placeholders differ.
  3. A reload where Trinity's next line has a different key (the stage moved on) still adds a second opener. That is by design (a new stage, a new line), and outside this fix.

Draft #4736 (same panel)

The two PRs conflict textually in all three shared files:

The changes are compatible in meaning. Merge #4735 first: it is a small P1 fix, ready now, and #4736 is a draft waiting on companion PRs. Then rebase #4736 onto it, keeping both:

#4736's OPENING also needs this PR's gate. Without it, a first status read made before the account report lands can decide the first-session question on incomplete data.

Recommendation: APPROVE, once pytest (head) finishes green.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after an independent validation (APPROVE) and green CI at fe09a31. Two non-blocking notes from the validation go to a follow-up.

@vybe
vybe merged commit 6e8ff3d into dev Nov 23, 2026
24 checks passed
trinity-ability pushed a commit that referenced this pull request Nov 23, 2026
Keeps both sides of the conflict:
- AssistantWidget startTalking(): #4735's openingDecided gate (agent list and
  example names read, status settled) now also gates the first-session
  OPENING, so the question is never decided on an early, incomplete status
  or an empty fleet that has not loaded yet.
- stores/assistant greet(): the first-session early return and #4735's
  dedupe of an opener already on screen.
- The panel spec: both describe blocks.

Validator notes on #4735 taken: the pending-opening placeholder no longer
hides on statusError, so a failed settle re-read keeps it instead of leaving
a blank conversation; and its bars use the pre-status skeleton's grays.

Tests (each shown red under the matching mutation, then restored):
- first-session question waits for the settled status (red with the old
  `!store.status` gate);
- waits for the agent list: a person with their own agent gets the hello
  (red with `prepared` dropped from openingDecided);
- a failed re-read keeps the placeholder (red with `&& !store.statusError`);
- dashboardHidesExamples.mount.spec.js: how the Dashboard decides which
  example agents to hide (system agent not counted as own, hand-off to the
  network store, show-on-request remembered, cleared on unmount).

Refs abilityai/trinity-enterprise#1355

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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