You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: v4.0.2 - Fix compaction context loss and agent creation
**Fixed**:
- Compaction losing context: Only filter orphaned function_call_output items, preserve matched pairs
- Agent creation failing: Properly detect streaming vs non-streaming requests
- SSE/JSON response handling: Convert SSE→JSON for generateText(), passthrough for streamText()
**Added**:
- gpt-5.1-chat-latest model support (normalizes to gpt-5.1)
**Technical**:
- Capture original stream value before transformation
- API always gets stream=true, but response handling based on original intent
- Orphan detection: only remove function_call_output without matching function_call
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,23 @@
2
2
3
3
All notable changes to this project are documented here. Dates use the ISO format (YYYY-MM-DD).
4
4
5
+
## [4.0.2] - 2025-11-27
6
+
7
+
**Bugfix release**: Fixes compaction context loss, agent creation, and SSE/JSON response handling.
8
+
9
+
### Fixed
10
+
-**Compaction losing context**: v4.0.1 was too aggressive in filtering tool calls - it removed ALL `function_call`/`function_call_output` items when tools weren't present. Now only **orphaned** outputs (without matching calls) are filtered, preserving matched pairs for compaction context.
11
+
-**Agent creation failing**: The `/agent create` command was failing with "Invalid JSON response" because we were returning SSE streams instead of JSON for `generateText()` requests.
12
+
-**SSE/JSON response handling**: Properly detect original request intent - `streamText()` requests get SSE passthrough, `generateText()` requests get SSE→JSON conversion.
13
+
14
+
### Added
15
+
-**`gpt-5.1-chat-latest` model support**: Added to model map, normalizes to `gpt-5.1`.
16
+
17
+
### Technical Details
18
+
- Root cause of compaction issue: OpenCode sends `item_reference` with `fc_*` IDs for function calls. We filter these for stateless mode, but v4.0.1 then removed ALL tool items. Now we only remove orphaned `function_call_output` items (where no matching `function_call` exists).
19
+
- Root cause of agent creation issue: We were forcing `stream: true` for all requests and returning SSE for all responses. Now we capture original `stream` value before transformation and convert SSE→JSON only when original request wasn't streaming.
20
+
- The Codex API always receives `stream: true` (required), but response handling is based on original intent.
21
+
5
22
## [4.0.1] - 2025-11-27
6
23
7
24
**Bugfix release**: Fixes API errors during summary/compaction and GitHub rate limiting.
**Why pin versions?** OpenCode uses Bun's lockfile which pins resolved versions. If you use `"opencode-openai-codex-auth"` without a version, it resolves to "latest" once and **never updates** even when new versions are published.
@@ -74,7 +74,7 @@ Simply change the version in your config and restart OpenCode:
0 commit comments