Commit Graph

9 Commits

Author SHA1 Message Date
roboomp 22f43b26ae fix(agent): preserved refusals in summaries
Scoped provider-refusal filtering to live replay so compaction and snapcompact summaries retain the refused turn while outbound provider context still drops the refusal.

Fixes #3592
2026-06-26 18:04:34 +00:00
roboomp d68980fe58 fix(agent): stopped replaying provider refusals
API-level refusals now stay visible as terminal errors without being sent back as assistant dialogue on the next provider request. Added core and coding-agent conversion coverage for Anthropic refusal metadata.

Fixes #3592
2026-06-26 17:56:07 +00:00
roboomp 897cce792f fix(coding-agent): split mixed file mentions so text stays on developer
Reviewer caught that demoting the whole mixed payload to `user` (`@notes.md
@screenshot.png`) regressed the developer-priority treatment text-only
mentions still get for image-free turns. `generateFileMentionMessages` packs
every `@…` into one `fileMention`, so the previous `hasImage` toggle
collapsed the source-file context into the user slot whenever an image was
attached.

`convertToLlm` now returns up to two messages per `fileMention` via
`flatMap`: text-only files keep their existing `developer` envelope, and
image-bearing files emit a separate `user` envelope that carries their
`<file>` wrappers plus the `input_image` block. Pure-text and pure-image
turns still collapse to a single message.

Tests cover the mixed case (split into developer + user), the image-only case
(single user message), and the existing text-only case (single developer
message).

Fixes #3443
2026-06-25 05:54:15 +00:00
roboomp c2174a87b2 fix(coding-agent): routed image-bearing @ mentions as user-role messages
Codex GPT models on chatgpt.com /codex/responses rejected `@image` turns with
`Codex error event: [OneOfParam] [input[N].content[M]] [invalid_enum_value]
Invalid value: 'input_image'. Supported values are: 'input_text'.` —
`convertToLlm`'s `fileMention` arm always emitted a `developer`-role
Responses message, but a developer-role content slot only accepts
`input_text`. #3421's prior fix only suppressed the Codex Responses Lite
header on image-bearing turns; the full transport kept rejecting the same body.

`fileMention` now uses `user` role when any attached file carries an image;
text-only mentions keep `developer` so the auto-read context still rides at
instruction priority for the agent.

Fixes #3443
2026-06-25 05:47:07 +00:00
can1357 80af40eb55 perf(coding-agent): stabilized steering message wrapping across turns
- Changed `wrapSteeringForModel` to wrap every `steering:true` user message regardless of position, so a steer's wire bytes stay identical once buried instead of reverting to raw and busting the prompt cache.
- Neutralized the present-tense framing in `user-interjection.md` so always-wrapping no longer leaves stale "current task" wording on buried interjections.
- Updated `session-messages.test.ts` to assert buried steering messages are wrapped too.
2026-06-19 06:58:06 +02:00
can1357 9f62c7904a feat(coding-agent): integrated snapcompact strategy and per-turn supersede pruning
Adds compaction.strategy: "snapcompact" to the schema and the AgentSession routing: when chosen, both manual /compact (without custom instructions) and auto compaction call snapcompactCompact() to archive history as PNG frames instead of an LLM summary. Falls back to context-full with a visible warning notice when the current model is text-only or when /compact gets custom instructions. CustomTool and shared-event payloads carry the new action through. \n\nAlso wires the per-turn supersede pass: #pruneSupersededReads() runs every turn before threshold gating (cache-aware: only fires when the post-candidate suffix is small or the prompt cache is cold), prunes older read results superseded by a newer read of the same file, rewrites the session, and accounts the saved tokens in the next compaction decision. Gated by compaction.supersedeReads (default on).\n\nsession/messages.ts now delegates the core role conversion to agent-core's convertMessageToLlm so snapcompact image blocks flow through the LLM-context conversion path.
2026-06-10 17:52:49 +02:00
can1357 e13f2de58a fix(coding-agent): mapped auxiliary messages to developer role for compaction
- Updated `convertToLlm` logic to emit `developer` role for custom, hook, and file-mention inputs.
- Simplified OpenAI compact output filtering to retain only `user` and `assistant` messages, removing legacy `system-reminder` pattern checks.
- Adjusted compaction and session tests to match the new developer-role mapping and expected compacted content.
2026-06-08 05:19:57 +02:00
can1357 4a9ee14e33 feat(coding-agent): wrapped mid-turn steers in wire-only envelope
- Marked steering user messages and wrapped them pre-LLM so the model sees a `` envelope.
- Kept transcripts and persisted history with the user's original raw text.
- Restored `AssistantMessageComponent` stable-prefix completion API.
2026-06-04 17:41:56 +02:00
maximhar 3119bfced5 fix(coding-agent): add explicit initiator attribution for Copilot headers (#246)
* fix(coding-agent): add explicit initiator attribution

Use message-level attribution for Copilot X-Initiator with role-based fallback, and persist attribution across custom/hook session paths.

Fixes #237

* fix(coding-agent): preserve legacy custom attribution fallback

* fix(coding-agent): remove async-result role special-case

* fix(coding-agent): inherit before_agent_start attribution from prompt

* test(coding-agent): tighten typing in attribution regressions
2026-03-02 17:01:44 +01:00