Skip to content

test(desktop): emit an authorizable 46040 in the channel presence spec - #141

Merged
oscarlehuu merged 9 commits into
mainfrom
devin/1786410067-fix-130-presence-needs-you
Aug 12, 2026
Merged

test(desktop): emit an authorizable 46040 in the channel presence spec#141
oscarlehuu merged 9 commits into
mainfrom
devin/1786410067-fix-130-presence-needs-you

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Cause: (a) harness-fidelity gap. No product break — zero production source changes in this PR.

channel-agent-presence.spec.ts › shows needs-you for a 46040 request faked the request through the generic __BUZZ_E2E_EMIT_MOCK_MESSAGE__ with kind: 46040 and an h tag only. Production is right to drop that event, so needsYouStore stayed empty and deriveChannelAgentPresence never produced a needs-you entry for the header dot:

emit 46040 {tags: [["h", channelId]]}
  → deriveUserInputRootEventId(event)          // userInput.ts:168-170: 0 `e` tags → null
  → validateAuthorizedUserInputRequest(...)     // rootEventId null; owner p tag missing;
                                                //   validatesRequestTrigger has no parent
  → null  ⇒ never ingested ⇒ no needs-you dot

The fix is fixture-side: the spec now emits what a real conversation produces — an owner kind:9 message mentioning the agent as the causal root, then the agent's 46040 as a canonical reply to it via #126's __BUZZ_E2E_EMIT_MOCK_USER_INPUT__ helper (durable, owner p tag, canonical e root/reply, 64-hex ids). Assertions are unchanged; nothing is skipped, relaxed, or newly waited on.

Each fixture change maps to the production rule that demanded it:

Fixture change Production rule
Canonical e root/reply tags on the request desktop/src/features/channels/lib/userInput.ts:168-190 (deriveUserInputRootEventId)
Owner p tag == current identity; 64-hex id/pubkey; request.channel_id == h desktop/src/features/agents/userInputAttentionProjection.ts:225-256 (validateAuthorizedUserInputRequest)
Causal parent that exists, shares the channel h, p-targets the agent, and roots the ancestry desktop/src/features/agents/userInputAttentionProjection.ts:95-145 (validatesRequestTrigger)
Request emitted through the shared helper (durable + seeded canonical parent) desktop/src/testing/e2eBridge.ts:10412-10468 (from #126, used unchanged)
Causal root emitted live into the timeline desktop/src/features/channels/ui/ChannelAgentPresence.tsx:172-182 — click-through resolves the conversation from a timeline message

Why #126's relay-registry fix does not apply here: the agent in this spec is a seeded managed agent, and seedMockManagedAgents (e2eBridge.ts ~2374-2390) already sets its profile owner_pubkey = MOCK_IDENTITY_PUBKEY, which is what useCurrentOwnedAgentPubkeysmergeOwnedAgentPubkeys filters on. So ownedAgent(...) already passed; only the causal/owner tagging was missing. No registry change was copied.

USER_INPUT_EVENT_IDUSER_INPUT_ROOT_EVENT_ID, since the constant now names the causal root rather than the request. CONVERSATION_ID is unchanged and still correct: deriveAgentConversationId(CHANNEL_ID, "c".repeat(64)) = afab2e62-a520-f16b-e63d-b291c2f679c9.

Stacked on #126 (base branch devin/1786360520-fix-110-channel-question-card), per the issue's instruction to reuse that helper rather than duplicate fixture logic — this spec needs #126's durable request, seeded canonical parent, and 64-hex createMockEvent ids. Retarget to main once #126 lands.

Docs: took decision slot D-040 (allocated by the orchestrator; D-028…D-039 are taken by in-flight PRs) to record the rule this class of bug keeps re-teaching — E2E fixtures may only emit events production could produce. STATE.md updated for the anti-drift rule.

Related issue

Fixes #130. Same family as #110 (PR #126) but a different surface (header presence dot via the attention projection) and a different fixture path.

Testing

RED on clean origin/main @ 35af74019 (bundle rebuilt, no branch changes):

Error: expect(locator).toBeVisible() failed
Locator: getByTestId('channel-agent-presence').getByTestId('channel-agent-presence-dot-needs-you')
Expected: visible
Error: element(s) not found
  184 |     await expect(
  185 |       presence.getByTestId("channel-agent-presence-dot-needs-you"),
> 186 |     ).toBeVisible();

1 failed
  [smoke] › tests/e2e/channel-agent-presence.spec.ts:100:3 › shows needs-you for a 46040 request and opens its real thread
1 passed (10.2s)

GREEN on this branch (pnpm --filter buzz build:e2e, then xvfb-run -a pnpm exec playwright test --project=smoke channel-agent-presence.spec.ts):

✓ 2 [smoke] › tests/e2e/channel-agent-presence.spec.ts › shows needs-you for a 46040 request and opens its real thread
2 passed (6.2s)

Not a coin flip — 12 consecutive runs, 24/24 tests passed, 0 flakes (6.0–6.2s each).

Also green: pnpm --filter buzz check, pnpm --filter buzz typecheck, and pnpm --filter buzz test (5045 passed / 0 failed / 1 skipped).

No visual change: the dot the spec asserts on is the existing needs-you state, now reachable.

Link to Devin session: https://app.devin.ai/sessions/b8611f3bb00946c786b45eea07c83785
Requested by: @oscarlehuu

@oscarlehuu oscarlehuu self-assigned this Aug 11, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786410067-fix-130-presence-needs-you branch from 74b2a96 to 8927391 Compare August 11, 2026 09:28
Base automatically changed from devin/1786360520-fix-110-channel-question-card to main August 11, 2026 12:27
devin-ai-integration Bot and others added 4 commits August 11, 2026 14:20
Keep mock user-input requests durable so late subscribers can hydrate them. Seed canonical causal parents and expose the owner-declared relay agent so authority validation matches a real relay. Generate valid 64-hex default event ids for mock events.

Fixes #110

Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Oscar Le <oscar.lehuu@gmail.com>
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Oscar Le <oscar.lehuu@gmail.com>
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Oscar Le <oscar.lehuu@gmail.com>
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Oscar Le <oscar.lehuu@gmail.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786410067-fix-130-presence-needs-you branch from 8927391 to 0b936f6 Compare August 11, 2026 14:20
@oscarlehuu
oscarlehuu merged commit a95236e into main Aug 12, 2026
9 of 12 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.

channel-agent-presence.spec.ts: needs-you dot never renders for a 46040 request (fails on main)

1 participant