-
Notifications
You must be signed in to change notification settings - Fork 89
runtime/analyze-conversation: route through callSite: 'analyzeConversation' #26126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,15 +8,18 @@ | |||||||||||||||||
| * Two triggers are supported: | ||||||||||||||||||
| * - **manual**: user-initiated analysis. Creates a fresh conversation each | ||||||||||||||||||
| * invocation, runs with `trustClass: "unknown"`, and strips the tool | ||||||||||||||||||
| * surface. Byte-for-byte unchanged from the original route logic. | ||||||||||||||||||
| * surface. | ||||||||||||||||||
| * - **auto**: called by the auto-analyze job when a source conversation | ||||||||||||||||||
| * reaches a natural pause. Reuses a rolling analysis conversation per | ||||||||||||||||||
| * parent (creating one if none exists), runs with `trustClass: | ||||||||||||||||||
| * "guardian"`, and keeps the full tool surface so the analysis agent can | ||||||||||||||||||
| * write memory and skills directly. Reads optional model overrides from | ||||||||||||||||||
| * `analysis.modelIntent` / `analysis.modelOverride` config. | ||||||||||||||||||
| * write memory and skills directly. | ||||||||||||||||||
| * | ||||||||||||||||||
| * Both triggers route the agent loop through `callSite: 'analyzeConversation'` | ||||||||||||||||||
| * so per-call provider/model selection flows through `resolveCallSiteConfig` | ||||||||||||||||||
| * against `llm.callSites.analyzeConversation` (populated by the unify-llm | ||||||||||||||||||
| * workspace migration from the legacy `analysis.modelIntent`/`modelOverride`). | ||||||||||||||||||
|
Comment on lines
+18
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Module docblock references "legacy" removed config fields, violating AGENTS.md rule The new module-level comment at
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||
| */ | ||||||||||||||||||
| import { getConfig } from "../../config/loader.js"; | ||||||||||||||||||
| import type { ServerMessage } from "../../daemon/message-protocol.js"; | ||||||||||||||||||
| import { | ||||||||||||||||||
| AUTO_ANALYSIS_GROUP_ID, | ||||||||||||||||||
|
|
@@ -31,7 +34,6 @@ import { | |||||||||||||||||
| getMessages, | ||||||||||||||||||
| } from "../../memory/conversation-crud.js"; | ||||||||||||||||||
| import { resolveConversationId } from "../../memory/conversation-key-store.js"; | ||||||||||||||||||
| import type { ModelIntent } from "../../providers/types.js"; | ||||||||||||||||||
| import { getLogger } from "../../util/logger.js"; | ||||||||||||||||||
| import { buildAssistantEvent } from "../assistant-event.js"; | ||||||||||||||||||
| import { DAEMON_INTERNAL_ASSISTANT_ID } from "../assistant-scope.js"; | ||||||||||||||||||
|
|
@@ -173,8 +175,6 @@ export async function analyzeConversation( | |||||||||||||||||
| let prompt: string; | ||||||||||||||||||
| let trustClass: "unknown" | "guardian"; | ||||||||||||||||||
| let stripTools: boolean; | ||||||||||||||||||
| let modelIntent: ModelIntent | undefined; | ||||||||||||||||||
| let modelOverride: string | undefined; | ||||||||||||||||||
|
|
||||||||||||||||||
| if (opts.trigger === "manual") { | ||||||||||||||||||
| const newConv = createConversation({ | ||||||||||||||||||
|
|
@@ -205,10 +205,6 @@ export async function analyzeConversation( | |||||||||||||||||
| prompt = buildAutoAnalysisPrompt(transcript); | ||||||||||||||||||
| trustClass = "guardian"; | ||||||||||||||||||
| stripTools = false; | ||||||||||||||||||
|
|
||||||||||||||||||
| const analysisConfig = getConfig().analysis; | ||||||||||||||||||
| modelIntent = analysisConfig.modelIntent; | ||||||||||||||||||
| modelOverride = analysisConfig.modelOverride; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // h. Load the conversation into memory with the appropriate trust | ||||||||||||||||||
|
|
@@ -219,13 +215,14 @@ export async function analyzeConversation( | |||||||||||||||||
| // Hoisted ahead of message persistence so the auto branch can detect a | ||||||||||||||||||
| // still-running prior agent loop on the rolling conversation and bail out | ||||||||||||||||||
| // before mutating any state. See concurrency guard below. | ||||||||||||||||||
| // | ||||||||||||||||||
| // Per-call model selection is no longer threaded through `getOrCreateConversation`; | ||||||||||||||||||
| // the runAgentLoop call below passes `callSite: 'analyzeConversation'` so the | ||||||||||||||||||
| // unified call-site resolver picks up provider/model from | ||||||||||||||||||
| // `llm.callSites.analyzeConversation`. | ||||||||||||||||||
|
Comment on lines
+219
to
+222
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Comment references removed code with "no longer" phrasing, violating AGENTS.md rule The new comment at
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||
| const analysisConversation = | ||||||||||||||||||
| await deps.sendMessageDeps.getOrCreateConversation( | ||||||||||||||||||
| analysisConversationId, | ||||||||||||||||||
| { | ||||||||||||||||||
| ...(modelIntent !== undefined ? { modelIntent } : {}), | ||||||||||||||||||
| ...(modelOverride !== undefined ? { modelOverride } : {}), | ||||||||||||||||||
| }, | ||||||||||||||||||
| ); | ||||||||||||||||||
|
Comment on lines
223
to
226
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 getOrCreateConversation called without second argument — verify no downstream impact The call to Was this helpful? React with 👍 or 👎 to provide feedback.
Comment on lines
223
to
226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This change removes the per-run Useful? React with 👍 / 👎. |
||||||||||||||||||
|
|
||||||||||||||||||
| // h.1. Concurrency guard (auto trigger only). The rolling analysis | ||||||||||||||||||
|
|
@@ -298,11 +295,14 @@ export async function analyzeConversation( | |||||||||||||||||
| analysisConversation.abortController = new AbortController(); | ||||||||||||||||||
| analysisConversation.currentRequestId = crypto.randomUUID(); | ||||||||||||||||||
|
|
||||||||||||||||||
| // l. Fire-and-forget the agent loop | ||||||||||||||||||
| // l. Fire-and-forget the agent loop. `callSite: 'analyzeConversation'` | ||||||||||||||||||
| // routes the per-call provider config through `resolveCallSiteConfig` | ||||||||||||||||||
| // against `llm.callSites.analyzeConversation`. | ||||||||||||||||||
| analysisConversation | ||||||||||||||||||
| .runAgentLoop(prompt, messageId, onEvent, { | ||||||||||||||||||
| isInteractive: false, | ||||||||||||||||||
| isUserMessage: true, | ||||||||||||||||||
| callSite: "analyzeConversation", | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new unconditional Useful? React with 👍 / 👎. |
||||||||||||||||||
| }) | ||||||||||||||||||
| .catch((err) => { | ||||||||||||||||||
| log.error( | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Test comment references "legacy" removed code, violating AGENTS.md rule
The new test comment at
assistant/src/runtime/services/__tests__/analyze-conversation.test.ts:409-411says "Per-call model selection now happens via the call-site resolver … not via legacy modelIntent/modelOverride keys". This narrates history ("now happens via") and references removed code ("legacy modelIntent/modelOverride"), violating theassistant/AGENTS.md:21rule about not referencing removed code in comments.Was this helpful? React with 👍 or 👎 to provide feedback.