fix(session): project steering messages as plain user content
steering/message previously rendered inside a <steering source="…"> envelope like context/message. No model is trained on a <steering> tag, so the framing is arbitrary markup the model was never taught to read; recorded transcripts show it treating the instruction as third-party metadata and refusing it. Framing also does not belong on the session surface — a caller that wants a frame formats its own content. It now projects verbatim as a plain user-role message; the <context> envelope is untouched and renderTagged becomes context-only. Agent Note: .agents/notes/implemented/simplification/2026-07-20-unwrap-steering-message-projection.md
This commit is contained in:
@@ -85,13 +85,11 @@ declare module 'cordis' {
|
||||
* canonical session vocabulary provider-neutral. Adapter-specific exceptions
|
||||
* belong in the adapter.
|
||||
*/
|
||||
function renderTagged(tag: string, content: ContentBlock[], source: MessageSource): ContentBlock[] {
|
||||
const open = `<${tag} source=${JSON.stringify(source.kind)}>`
|
||||
const close = `</${tag}>`
|
||||
function renderContextEnvelope(content: ContentBlock[], source: MessageSource): ContentBlock[] {
|
||||
return [
|
||||
{ type: 'text', text: open },
|
||||
{ type: 'text', text: `<context source=${JSON.stringify(source.kind)}>` },
|
||||
...content,
|
||||
{ type: 'text', text: close },
|
||||
{ type: 'text', text: '</context>' },
|
||||
]
|
||||
}
|
||||
|
||||
@@ -241,7 +239,7 @@ export function renderContextContent(
|
||||
envelope: ContextEnvelope = 'context',
|
||||
): ContentBlock[] {
|
||||
const cloned = structuredClone(content)
|
||||
return envelope === 'raw' ? cloned : renderTagged('context', cloned, source)
|
||||
return envelope === 'raw' ? cloned : renderContextEnvelope(cloned, source)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,8 +529,7 @@ export class Session {
|
||||
return { role: 'user', content: renderContextContent(content, source, envelope) }
|
||||
}
|
||||
case 'steering/message': {
|
||||
const { content, source } = event.data
|
||||
return { role: 'user', content: renderTagged('steering', content, source) }
|
||||
return { role: 'user', content: event.data.content }
|
||||
}
|
||||
default:
|
||||
// A non-surface event (boundary, chunk, log-only record) projects to
|
||||
|
||||
Reference in New Issue
Block a user