Repository navigation
fix(acp): keep OMP replies that follow its reasoning #26658
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ba43279
fix(acp): keep OMP replies that follow its reasoning
brennanb2025 f2ea942
Merge remote-tracking branch 'origin/main' into brennanb2025/omp-acp-…
brennanb2025 3f52e6f
Merge remote-tracking branch 'origin/main' into brennanb2025/omp-acp-…
brennanb2025 20072b9
Merge remote-tracking branch 'origin/main' into brennanb2025/omp-acp-…
brennanb2025 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import { afterEach, describe, expect, it } from 'vitest' | ||
| import { | ||
| closeProviderTimelineRigs, | ||
| SESSION | ||
| } from '../native-chat/agent-session-timeline/provider-timeline-assembler-test-support' | ||
| import { recordingStructuredAgentSessionLogger } from '../native-chat/agent-session-wire/structured-agent-session-logger-test-support' | ||
| import { acpLaunchSpecFor } from './acp-launch-specs' | ||
| import { | ||
| openAcpAdapterRig, | ||
| PROVIDER_SESSION, | ||
| sendHello, | ||
| waitFor | ||
| } from './acp-structured-adapter.test-support' | ||
|
|
||
| afterEach(closeProviderTimelineRigs) | ||
|
|
||
| describe.each(['omp', 'opencode', 'grok'] as const)('%s provider message ownership', (agent) => { | ||
| it.each([ | ||
| { stopReason: 'end_turn', nextPrompt: false }, | ||
| { stopReason: 'cancelled', nextPrompt: false }, | ||
| { stopReason: 'end_turn', nextPrompt: true }, | ||
| { stopReason: 'cancelled', nextPrompt: true } | ||
| ] as const)( | ||
| 'refuses a late answer after $stopReason (next prompt: $nextPrompt)', | ||
| async ({ stopReason, nextPrompt }) => { | ||
| const recording = recordingStructuredAgentSessionLogger() | ||
| let prompts = 0 | ||
| const rig = await openAcpAdapterRig({ | ||
| spec: acpLaunchSpecFor(agent)!, | ||
| deps: { logger: recording.logger }, | ||
| script: (scripted) => { | ||
| scripted.on('session/prompt', (frame) => { | ||
| prompts += 1 | ||
| scripted.notify('session/update', { | ||
| sessionId: PROVIDER_SESSION, | ||
| _meta: { promptId: `prompt:send-${prompts}` }, | ||
| update: { | ||
| sessionUpdate: 'agent_thought_chunk', | ||
| messageId: prompts === 1 ? 'first-message' : 'next-message', | ||
| content: { type: 'text', text: `Thought ${prompts}` } | ||
| } | ||
| }) | ||
| if (prompts === 1) { | ||
| scripted.reply(frame, { stopReason }) | ||
| } | ||
| }) | ||
| } | ||
| }) | ||
| await rig.acquire() | ||
| await sendHello(rig, 'send-1') | ||
| await waitFor(async () => | ||
| expect(await rig.rig.turns()).toMatchObject([ | ||
| { state: stopReason === 'cancelled' ? 'interrupted' : 'completed' } | ||
| ]) | ||
| ) | ||
| if (nextPrompt) { | ||
| await sendHello(rig, 'send-2') | ||
| await waitFor(async () => expect(await rig.rig.turns()).toHaveLength(2)) | ||
| } | ||
| rig.child().agent.notify('session/update', { | ||
| sessionId: PROVIDER_SESSION, | ||
| update: { | ||
| sessionUpdate: 'agent_message_chunk', | ||
| messageId: 'first-message', | ||
| content: { type: 'text', text: 'Private late answer' } | ||
| } | ||
| }) | ||
| await waitFor(() => | ||
| expect(recording.entries).toContainEqual({ | ||
| level: 'warn', | ||
| message: 'ACP text chunk rejected by its message stream', | ||
| fields: { | ||
| scope: 'acp-text-turn-settled', | ||
| reason: 'turn-settled', | ||
| sessionId: SESSION, | ||
| providerSessionId: PROVIDER_SESSION, | ||
| agent, | ||
| generation: 'gen-acp', | ||
| itemId: 'message:["first-message","assistant"]', | ||
| channel: 'assistant', | ||
| threadId: PROVIDER_SESSION, | ||
| turnId: 'prompt:send-1' | ||
| } | ||
| }) | ||
| ) | ||
| if (nextPrompt) { | ||
| rig.child().agent.notify('session/update', { | ||
| sessionId: PROVIDER_SESSION, | ||
| _meta: { promptId: 'prompt:send-2' }, | ||
| update: { | ||
| sessionUpdate: 'agent_message_chunk', | ||
| messageId: 'next-message', | ||
| content: { type: 'text', text: 'Next answer' } | ||
| } | ||
| }) | ||
| rig.child().agent.reply(await rig.frame('session/prompt', 1), { stopReason: 'end_turn' }) | ||
| await waitFor(async () => | ||
| expect(await rig.rig.turns()).toMatchObject([ | ||
| { state: stopReason === 'cancelled' ? 'interrupted' : 'completed' }, | ||
| { state: 'completed', outcome: 'success' } | ||
| ]) | ||
| ) | ||
| } | ||
| const rows = await rig.rig.rows() | ||
| expect( | ||
| rows | ||
| .filter((row) => row.body.kind === 'message' && row.body.role === 'assistant') | ||
| .map((row) => row.body) | ||
| ).toMatchObject(nextPrompt ? [{ blocks: [{ text: 'Next answer' }] }] : []) | ||
| expect(rows.filter((row) => row.body.kind === 'status')).toEqual([]) | ||
| await rig.adapter.closeSession(SESSION) | ||
| } | ||
| ) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Redact provider message IDs in text-drop diagnostics. When an ACP agent places private text in
messageId,acpNamedTextKeyincludes that value initemId, and this spread sends it unchanged to console and span attributes. Log a bounded hash or masked identifier instead. Keep the full key for internal row identity. Based on learnings, log masked or truncated identifiers rather than unredacted provider data.🧰 Tools
🪛 ast-grep (0.45.3)
[warning] 172-179: Avoid logging sensitive data
Context: this.logger.warn('ACP text chunk rejected by its message stream', {
scope:
acp-text-${drop.reason},sessionId: this.deps.sessionId,
providerSessionId: this.deps.providerSessionId,
agent: this.deps.agent,
generation: this.deps.generation,
...drop
})
Note: [CWE-532] Insertion of Sensitive Information into Log File.
(log-sensitive-data-typescript)
Sources: Learnings, Linters/SAST tools