Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions assistant/src/__tests__/voice-session-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,45 @@ describe("voice-session-bridge", () => {
expect(abortCalled).toBe(true);
});

test("startVoiceTurn passes callSite: 'callAgent' to runAgentLoop", async () => {
const conversation = createConversation("voice bridge callSite test");
const events: ServerMessage[] = [
{ type: "message_complete", conversationId: conversation.id },
];

let capturedOptions: Record<string, unknown> | undefined;
const session = {
...makeStreamingSession(events),
runAgentLoop: async (
_content: string,
_messageId: string,
onEvent: (msg: ServerMessage) => void,
options?: Record<string, unknown>,
) => {
capturedOptions = options;
for (const event of events) {
onEvent(event);
}
},
} as unknown as Conversation;

injectDeps(() => session);

await startVoiceTurn({
conversationId: conversation.id,
content: "Hello",
isInbound: true,
onTextDelta: () => {},
onComplete: () => {},
onError: () => {},
});

await new Promise((r) => setTimeout(r, 50));

expect(capturedOptions).toBeDefined();
expect(capturedOptions?.callSite).toBe("callAgent");
});

test("external AbortSignal triggers turn abort", async () => {
const conversation = createConversation("voice bridge signal test");
let abortCalled = false;
Expand Down
5 changes: 5 additions & 0 deletions assistant/src/calls/voice-session-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ export async function startVoiceTurn(
// Note: tool_use_preview_start is intentionally not handled here.
// Voice only reacts to the definitive tool_use_start event.
},
// Route every voice-call agent loop turn through the unified
// `llm.callSites.callAgent` resolver. PR 4 backfilled this entry
// from the legacy `config.calls.model` setting, so existing
// overrides continue to apply.
Comment on lines +526 to +528

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Rewrite comment to avoid historical implementation details

This new comment references removed behavior (legacy config.calls.model) and PR history, which violates the documented comment standard in assistant/AGENTS.md (“comments should describe the current state of the codebase, not narrate its history”). Keeping history in inline comments tends to become stale and misleads future readers, so this should be rewritten to describe only the present callSite behavior.

Useful? React with 👍 / 👎.

{ callSite: "callAgent" },
Comment on lines +525 to +529

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 history and references a PR, violating mandatory AGENTS.md comment rule

The added comment on lines 525-528 says PR 4 backfilled this entry from the legacy config.calls.model setting, so existing overrides continue to apply. This violates the mandatory rule in assistant/AGENTS.md:21: "do not reference code that has been removed. 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'." The comment references "PR 4" and the "legacy config.calls.model setting", both of which narrate historical context rather than describing the current state.

Suggested change
// Route every voice-call agent loop turn through the unified
// `llm.callSites.callAgent` resolver. PR 4 backfilled this entry
// from the legacy `config.calls.model` setting, so existing
// overrides continue to apply.
{ callSite: "callAgent" },
// Route every voice-call agent loop turn through the unified
// `llm.callSites.callAgent` resolver so workspace-level model
// overrides for voice calls are respected.
{ callSite: "callAgent" },
Open in Devin Review

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

);
if (lastError) {
log.error(
Expand Down
Loading