Skip to content

meet: wire chat-opportunity detector to agent-wake in session lifecycle#25949

Merged
siddseethepalli merged 1 commit into
mainfrom
run-plan/meet-phase-2-chat/pr-7
Apr 15, 2026
Merged

meet: wire chat-opportunity detector to agent-wake in session lifecycle#25949
siddseethepalli merged 1 commit into
mainfrom
run-plan/meet-phase-2-chat/pr-7

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

@siddseethepalli siddseethepalli commented Apr 15, 2026

Summary

  • MeetSessionManager instantiates MeetChatOpportunityDetector on join (when proactiveChat.enabled)
  • Tier 2 LLM callback wraps provider abstraction with modelIntent: latency-optimized
  • onOpportunity → wakeAgentForOpportunity({ source: 'meet-chat-opportunity' })
  • Detector disposed in leave(); per-meeting summary stats logged on meet.left
  • Default resolveTarget adapter wired into agent-wake so session-manager can call it with just { conversationId, hint, source }

Part of plan: meet-phase-2-chat.md (PR 7 of 8)


Open with Devin

@siddseethepalli siddseethepalli merged commit 33b0e54 into main Apr 15, 2026
@siddseethepalli siddseethepalli deleted the run-plan/meet-phase-2-chat/pr-7 branch April 15, 2026 23:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d80e24ad46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +811 to +817
onOpportunity: (hint: string) => {
void this.deps
.wakeAgent({
conversationId,
hint,
source: "meet-chat-opportunity",
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard wake callback after session teardown

The onOpportunity callback unconditionally calls wakeAgent(...) even after leave() has started/finished. leave() only calls chatOpportunityDetector.dispose(), which unsubscribes future events but does not cancel an already in-flight Tier-2 LLM check in MeetChatOpportunityDetector.maybeRunTier2; a verdict that resolves after teardown can still invoke this callback and wake the agent for a meeting that already ended. In that timing window, the assistant can run an extra background turn (and potentially trigger tools) after session shutdown, which violates the intent of the teardown path.

Useful? React with 👍 / 👎.

Comment on lines +794 to +796
const conversation =
await this.getOrCreateConversation(conversationId);
return conversationToWakeTarget(conversation);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid creating conversations in default wake resolver

The default resolver uses getOrCreateConversation(conversationId), so a stale/invalid wake target does not resolve to null as wakeAgentForOpportunity expects; it creates a new conversation and proceeds. This is risky in late-callback or deleted-conversation scenarios (for example, an opportunity arriving after meeting teardown), because it can spawn a ghost conversation and run an unintended LLM/tool turn instead of safely skipping. The resolver should resolve an existing conversation (or verify DB existence) and return null when the target is gone.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines +88 to +100
// ── Process-wide default resolver ────────────────────────────────────
//
// PR 6 shipped `wakeAgentForOpportunity` with a required `deps` argument
// carrying an explicit `resolveTarget`. PR 7 needs to call the helper
// from code paths (e.g. `MeetSessionManager.join`) that don't know how
// to build a `WakeTarget` — the adapter that wraps a live `Conversation`
// lives in the daemon, not the skill. To avoid importing daemon code
// into `runtime/agent-wake.ts` (and the skill bundle that wires
// proactive-chat into the manager), we expose a module-level default
// resolver that the daemon installs once at startup. Callers that don't
// pass explicit `deps` fall back to it. Tests that pass explicit deps
// are unaffected — the default is never consulted when deps are
// supplied.
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.

🔴 Comment narrates PR history, violating assistant/AGENTS.md comment rule

The block comment at assistant/src/runtime/agent-wake.ts:88-100 narrates the codebase's evolution with phrases like "PR 6 shipped wakeAgentForOpportunity with a required deps argument" and "PR 7 needs to call the helper from code paths…". The assistant/AGENTS.md rule states: "Comments should describe the current state of the codebase, not narrate its history. Avoid phrases like 'no longer does X', 'previously used Y', or 'was removed in PR Z'." This comment should be rewritten to describe the current architecture (a module-level default resolver that the daemon installs at startup, allowing callers that don't have access to WakeTarget construction to use the wake helper without explicit deps) without referencing PR numbers or how the design evolved.

Suggested change
// ── Process-wide default resolver ────────────────────────────────────
//
// PR 6 shipped `wakeAgentForOpportunity` with a required `deps` argument
// carrying an explicit `resolveTarget`. PR 7 needs to call the helper
// from code paths (e.g. `MeetSessionManager.join`) that don't know how
// to build a `WakeTarget` — the adapter that wraps a live `Conversation`
// lives in the daemon, not the skill. To avoid importing daemon code
// into `runtime/agent-wake.ts` (and the skill bundle that wires
// proactive-chat into the manager), we expose a module-level default
// resolver that the daemon installs once at startup. Callers that don't
// pass explicit `deps` fall back to it. Tests that pass explicit deps
// are unaffected — the default is never consulted when deps are
// supplied.
// ── Process-wide default resolver ────────────────────────────────────
//
// `wakeAgentForOpportunity` accepts an optional `deps` argument with an
// explicit `resolveTarget`. Code paths that don't know how to build a
// `WakeTarget` (e.g. `MeetSessionManager.join`) omit `deps` and fall
// back to a module-level default resolver that the daemon installs once
// at startup. The adapter that wraps a live `Conversation` as a
// `WakeTarget` lives in the daemon, not here, so the skill bundle never
// imports daemon code. Tests that pass explicit deps are unaffected —
// the default is never consulted when deps are supplied.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@siddseethepalli
Copy link
Copy Markdown
Contributor Author

Follow-up shipped in #26265 — addresses consolidated review feedback (chat concurrency mutex, dispose teardown, wake adapter timeout/ghost prevention, tokenEstimationProvider forwarding, E2E test flakiness).

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.

1 participant