Repository navigation
fix(portal): an open page hears when its agent becomes available - #4468
Conversation
…eing swallowed (abilityai/trinity-enterprise#1220) `_maybe_invalidate_rosters` skipped a slot whose roster refresh was already in flight. When that read ran before a share committed, the share's `agent_shared` was lost and the slot kept the smaller roster until an unrelated access change happened to refresh it, so every allowed event about the newly shared agent was withheld. The slot now carries `refresh_again`, set on a skipped invalidation; `_refresh_slots` repeats its read until no mark is left. Tests: tests/unit/test_1220_ws_roster_share_refresh.py — the in-flight case went red on today's code (roster stayed empty), green with the fix; the share-event contract for a Workspace-only slot is pinned alongside it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng one event (abilityai/trinity-enterprise#1220) A send held while the member's assistant is starting went out only on the `member_progress_update` event; one lost event stranded the words for the full three minutes and then handed them back although the assistant was ready. - While a send is held the card is re-read every 30 s, and once more at the ceiling before the words are handed back. Only a read that says ready sends; starting, failed, a failed read or a missing step hand back. A flip a re-read caught logs a console warning: the event did not arrive. - One consumer (`takeHeldSend`): the watch and the hand-back continuation can both see the flip, and exactly one sends. - Leaving the chat mid re-read sends nothing; the words stay the draft. - `portalProgress.fetchProgress` returns the read already in flight instead of an early `undefined`, so an awaited re-read is a real read. Tests: portalMemberHeldSend.mount.spec.js 13 (4 new cases red before the fix). Mutations, each restored byte-identical: dropping the in-flight return, the unmount flag, the single-consumer check, or the poll each turns its named case red. Raw colors on PortalConversation.vue unchanged (0 non-gray, 85 gray, 0 hex). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ations re-read (abilityai/trinity-enterprise#1220) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… once it settles (abilityai/trinity-enterprise#1220) A forced read (the member-ready event's, the held send's hand-back) used to join a poll read already in flight, which may have been issued before assistant_ready went done. It now chains one re-read after that read settles, shared by every forced caller. Unforced callers still join. Red without the fix: 'a forced read during an in-flight read re-reads after it settles' (1 GET, expected 2). Also corrects the _maybe_invalidate_rosters docstring: a missed unshare or delete leaves the roster larger, not smaller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trinity-ability
left a comment
There was a problem hiding this comment.
PR Validation Report — #4468
PR: fix(portal): an open page hears when its agent becomes available · Author: vybe · feature/1220-member-ready-event → dev · 8 files (+437/−25) · Lane B (no schema) · draft
❗ Conflicts with dev, and the backend half is already on dev
git merge-tree origin/dev <head> conflicts in 2 files:
src/backend/services/event_bus.pydocs/memory/architecture/integrations.md
The cause is #4426 (merged after this branch's base fb7552381). It already ships the same fix in event_bus.py: the refresh_again field, _claim_slot() marking a busy slot instead of skipping it, and _refresh_slots() reading again when the mark is set. It also adds a once-a-minute roster re-read. That leaves this PR's backend change redundant. I checked this by running the PR's new test against dev's event_bus.py:
event_bus.py |
test_1220_ws_roster_share_refresh.py |
|---|---|
| PR head | 3 passed |
| merge base (fix reverted) | 1 failed (test_an_invalidation_during_an_in_flight_refresh_is_not_swallowed), 2 passed |
origin/dev |
3 passed |
How to resolve: rebase onto dev, take dev's event_bus.py as-is, and drop this PR's changes to it. Keep the new test, which pins the behaviour #4426 shipped. In integrations.md, put your sentence on top of dev's text: the /ws scope paragraph and the new "Live connections follow the account" paragraph both changed there. The frontend half does not conflict.
Summary
| Category | Status | Notes |
|---|---|---|
| Commit messages | ✅ | conventional, descriptive |
| Base branch | ✅ | dev |
| PR size | ✅ | 8 files |
| Status auto-promotion | ✅ | Fixes with a cross-tracker ref, which resolves (open, P1). Auto-promotion only works within one repo, so set status-in-dev by hand after merge |
| Journey Impact | ✅ | check_journey_impact.py exits 0 (no declaration; allowed) |
| Requirements / Architecture | ✅/❌ | architecture area file updated, but conflicts (above) |
| Feature flows | ➖ | behaviour fix; no flow change needed |
| Security (§4.1–4.10) | ✅ | no keys or IPs; only @example.com emails; no mode changes or host paths |
| Build / config packaging | ➖ | no new package or env var |
| Audit rows (§4.11) | ➖ | no gated write handler touched |
| Cross-surface drift (§5.5) | ✅ | no router changed; event_bus.py has no agent-server twin |
| Structural review | the PR body describes the author's own review pass; no /review is posted on the PR |
|
| Merge gate (6.5) | ❌ | no checks have run on this PR: it is a draft and conflicting, so there is no merge ref. Tier 1 needs to run after the rebase. dev-ci is currently success |
| Test adequacy | ✅ | named regression tests on both halves; non-happy paths covered (failed re-read, unmount mid-read, in-flight read at the 3-minute ceiling) |
| Code quality | ✅/ |
see warnings |
| Product fit / Bar 7–11 | ✅ | issue approved (status-ready); the change stays inside its scope; no new route, tool or setting |
Execution coverage (§5.4)
| Changed symbol / test | Executed by | Live consumer | Verdict |
|---|---|---|---|
StreamDispatcher refresh-again |
test_1220_ws_roster_share_refresh.py via _fanout |
the /ws dispatcher |
✅ (now dev's code) |
PortalConversation.vue held send (re-read poll, ceiling re-read, watch) |
portalMemberHeldSend.mount.spec.js (real mount, fake timers, HTTP seam) |
member chat composer | ✅ |
portalProgress.fetchProgress in-flight / forced re-read |
portalProgressStore.spec.js + the mount spec |
handleWebSocketEvent, refetchAll, held send |
✅ |
Mutations: three of them, each run from a scratch copy:
- Reverting
PortalConversation.vuefails 4 of 13 tests in the mount spec. - Reverting
portalProgress.jsfails 1 test in the mount spec and 1 of 8 in the store spec. - Reverting
event_bus.pyfails 1 of 3 in the new pytest file.
Every test file the PR touches passes at head, each run alone: pytest test_1220_ws_roster_share_refresh.py 3 passed; vitest portalMemberHeldSend.mount.spec.js 13 passed, portalProgressStore.spec.js 8 passed. test_event_bus.py was also run, as context: 23 passed.
Issues found
Critical (block merge)
- Merge conflicts in
src/backend/services/event_bus.pyanddocs/memory/architecture/integrations.md. Resolve by takingdev'sevent_bus.py(see above). - Tier 1 CI has not run. Re-check after the rebase.
Warnings
portalProgress.js: a forced call made whileloadingis true chainsinFlight.get(agentName).then(...). If a card is everloadingwith no entry in the map, that call throws aTypeError. Today onlyfetchProgresssetsloading, so this can't happen yet, but(inFlight.get(agentName) ?? Promise.resolve())would make it safe.inFlight/againare module-level maps, not store state, so they outlive a Pinia instance. This is harmless in the app, but a test that resets Pinia mid-read shares them.- Behaviour change in the
assistantIsStartingwatch. A flip to "not starting" now hands the words back unlessassistant_readyreadsdone. Before, it sent unless the step hadfailed. For example, a card cleared to empty now hands back instead of sending. This looks intended ("unknown is not ready"), but it is worth one line in the PR body. - The "event did not arrive"
console.warncan fire falsely: if the WS-driven flip lands while a 30-second re-read is in flight, the warning blames the re-read. It's only a log line, but it is diagnostic noise.
Recommendation
REQUEST CHANGES. The frontend fix is sound and is proven by mutation. The branch has to be rebased: the backend half is superseded by #4426 and conflicts, and CI has not run.
This PR requires the following changes before merge:
- [ ] Rebase on dev; resolve event_bus.py by taking dev's version (refresh_again already shipped in #4426) — keep test_1220_ws_roster_share_refresh.py, which passes against it
- [ ] Re-apply the integrations.md sentence on top of dev's text
- [ ] Let Tier 1 CI run green
PR #4468 — REQUEST CHANGES — merge gate: ❌ (conflicting, no checks run)
#4426 landed the same in-flight roster re-read on dev, so dev's src/backend/services/event_bus.py is taken whole. In integrations.md dev's text already describes the queued re-read; only the share-writer broadcast rule is re-applied on top of it. test_1220_ws_roster_share_refresh.py passes against dev's event bus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trinity-ability
left a comment
There was a problem hiding this comment.
PR Validation Report — re-validation after fix 2
PR: #4468 — fix(portal): an open page hears when its agent becomes available
Head: 0a1124091 (merge of origin/dev, which already contains the current dev tip) · feature/1220-member-ready-event → dev
Files: 7 (+403/−13) · Lane B (frontend store/component + tests + docs, no deletions in tests/, no schema)
What changed since the last pass
The merge resolved src/backend/services/event_bus.py to dev's version, so this PR no longer touches the event bus. dev (via #4426) already carries the same refreshing / refresh_again re-read, and tests/unit/test_1220_ws_roster_share_refresh.py now pins that code on dev as a regression test. The PR's own code changes are now frontend-only: PortalConversation.vue and stores/portalProgress.js.
Summary
| Category | Status | Notes |
|---|---|---|
| Base branch / size | ✅ | dev, 7 files |
| Commits | ✅ | conventional prefixes, descriptive |
| Status auto-promotion | ✅ | cross-tracker Fixes …#1220. The issue is in the other tracker, so after merge set status-in-dev by hand |
| Journey Impact | ✅ | check_journey_impact.py exit 0 (none declared, which is allowed) |
| Architecture doc | ✅ | architecture/integrations.md: one added sentence saying share and unshare writers must broadcast the thin {name} event |
| Security §4.1–4.3, 4.10 | ✅ | no keys, real emails, IPs, mode flips or host paths. The enterprise-docs grep has no hit |
| Audit rows §4.11 | ➖ | no gated write handler touched |
| Build / config packaging | ➖ | no new backend dir or env var |
| Cross-surface drift §5.5 | ➖ | no router or agent-server twin changed |
| Test adequacy | ✅ | covers the non-happy paths: failed re-read hands back, unmount mid-read, in-flight read at the ceiling, forced vs. unforced join |
| Product fit | ✅ | issue is status-ready, P1. Every behaviour change maps to the issue's problem. No new route, setting or tool |
| Merge gate (Tier 1) | ✅ | all checks finished on 0a1124091, see below |
Execution coverage (§5.4) — mutation-verified
| changed symbol | executed by | mutation result |
|---|---|---|
portalProgress.fetchProgress in-flight / forced re-read (inFlight, again) |
portalProgressStore.spec.js |
store reverted to dev → 1 red ("a forced read during an in-flight read re-reads after it settles") |
PortalConversation held-send re-read / ceiling (rereadHeldSendProgress, handBackHeldSend, sendHeld) |
portalMemberHeldSend.mount.spec.js (real mount) |
component reverted to dev → 4 red |
StreamDispatcher refresh_again (now dev's code) |
test_1220_ws_roster_share_refresh.py |
both slot.refresh_again = True sites replaced with a no-op → 1 red ("invalidation during an in-flight refresh is not swallowed") |
None of these tests reads source text. Every assertion runs through a mount, the store, or _fanout.
Local runs (each command under its limit, run one after another)
- pytest under
prlimit --as=2500000000:test_1220_ws_roster_share_refresh3 passed ·test_event_bus23 passed - vitest under
NODE_OPTIONS=--max-old-space-size=2048:portalMemberHeldSend.mount13 ·portalProgressStore8 ·portalProgressCardCollapse+portalProgressCardFailedDefault8 · raw-color / loading-gate / source-text ratchets 28 — all passed
CI on 0a1124091
Passed: pytest (head, seed 12345) (24m21s), regression diff, Analyze (python), Analyze (javascript-typescript), CodeQL, schema-parity, verify-non-root, gitleaks, both guard jobs, lint (sys.modules pollution check), build, e2e, journey-impact, backend boots without enterprise submodule, verify-compose-file-sets, verify-docker-gid-detection, cached dev baseline.
Skipped (as expected): journey-smoke (Lane B does not need it on the PR), pytest (base, inline fallback) (the cached baseline was present), pytest (push, absolute failures), report, auto-merge, clear-needs-fix.
dev itself: dev-ci success ("all Tier 2 workflows green"), and no open dev-ci red issue.
Warnings / suggestions (non-blocking)
- PR body is stale. The "Event bus" bullet and the backend lines in "Tests" describe a change this branch no longer makes, since it is now on
devvia #4426. Suggest rewording to: "the event-bus re-read landed ondevin #4426; this PR adds its regression test". - Accepted follow-up (per rider): the
console.warn"the event did not arrive" log. It is not treated as a blocker here. - Structural pass: the body reports a reading review and a security pass. This report does not repeat the SQL, race or auth review.
- The PR is still a draft. It waits on the operator's merge call.
Recommendation
APPROVE (report-only). Tier 1 is green, dev is green, and every changed path is executed by a test that a mutation proves can fail.
trinity-ability
left a comment
There was a problem hiding this comment.
merge-train: batch validated on train/20261111-1719 (#4480)
#4481) Brings the private halves of the two Workspace fixes onto dev: - ent#1222: the assignment provider reports proactive reachability and the owner as primary reads as consented (pairs with #4467) - ent#1224: member agents announce a ready agent to the open member page (pairs with #4468) Co-authored-by: trinity-ability <309458136+trinity-ability@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
A member's page could miss the moment their agent became available, so the first message they typed was held for minutes and handed back unsent.
test_1220_ws_roster_share_refresh.pypins it.Fixes abilityai/trinity-enterprise#1220 (private tracker). The private half is a paired PR in that repo; the
src/backend/enterprisegitlink is not moved on this branch.Tests
Each file run alone: test_1220_ws_roster_share_refresh 3, test_event_bus 23 (on the merged head). Vitest: portalMemberHeldSend.mount 13, portalProgressStore 8, portalProgressCardCollapse.mount 3, portalProgressCardFailedDefault.mount 5. Four mutations each caught at build time.
Review
Reading review + security pass: MERGEABLE, 0 critical, security clean. /validate-pr: APPROVE on
0a1124091, all CI green. Follow-up (not blocking): the "event did not arrive" console warning can fire when the event lands during a re-read.Draft until the operator's merge call.
🤖 Generated with Claude Code