@inetafrica/open-claudia 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.0.9 — one fat record no longer kills the turn
4
+
5
+ - **Decoder failures are warnings, not run failures.** The v3 JSONL stream decoder capped provider records at 1MB and surfaced any oversized or malformed line as a terminal `error` event — so a single base64-image tool result (routine in image workflows) killed an otherwise healthy live turn with `Claude Code run failed: Provider JSONL record exceeded 1048576 bytes` (rahil, v3.0.8, 2026-07-12). `LINE_TOO_LARGE` / `MALFORMED_JSON` now normalize to a new non-terminal `warning` event: the record is skipped, the stream continues, and the warning is logged. If the dropped line happened to be the terminal record, the existing `PROVIDER_MISSING_TERMINAL` net still fails the run cleanly.
6
+ - **Line cap raised 1MB → 16MB.** Image-bearing records are legitimate; the cap now exists to bound memory, not to police normal payloads.
7
+ - **Agent-space / OpenClaw:** no new deps, no new env, no schema change; Docker image builds identically (FROM the pre-baked `:base`). Coverage: warning-shape assertions in `test-provider-events.js`, default-cap pin in `test-provider-stream-decoder.js`.
8
+
3
9
  ## v3.0.6 — cache-bust burn is now a one-line query
4
10
 
5
11
  - **Usage records carry a `coldStart` flag.** The restart→cache-bust burn (each bot restart re-bills the whole accumulated window as cache *writes* instead of ~13×-cheaper cache *reads*) was invisible to every token-count analysis — same token counts, different price class — and took a forensic reconstruction of the 22-day usage history to quantify (~8% of all spend, ~$12/day at its worst). Now the first usage record a process writes for each session is tagged `coldStart: true`: a cold start mid-conversation is the restart fingerprint, so the burn is one jq filter away instead of a modelling exercise. Records already carried `cacheReadTokens`/`cacheCreationTokens`; this adds the missing "was the cache necessarily cold?" dimension.
@@ -10,9 +10,12 @@ const NORMALIZED_EVENT_TYPES = Object.freeze([
10
10
  "usage",
11
11
  "result",
12
12
  "error",
13
+ "warning",
13
14
  ]);
14
15
 
15
- const DEFAULT_MAX_LINE_BYTES = 1024 * 1024;
16
+ // 16MB: tool results carrying base64 images legitimately exceed 1MB — the old
17
+ // cap killed rahil's image-workflow turn (v3.0.8) on a single oversized record.
18
+ const DEFAULT_MAX_LINE_BYTES = 16 * 1024 * 1024;
16
19
 
17
20
  function decoderError(code, message, details = {}) {
18
21
  return { type: "decoder.error", code, message, ...details };
@@ -133,11 +136,13 @@ function providerErrorFlags(message) {
133
136
 
134
137
  function normalizeDecoderError(rawEvent) {
135
138
  if (!rawEvent || rawEvent.type !== "decoder.error") return null;
139
+ // Warning, not error: a single oversized or malformed record is skippable.
140
+ // If the dropped line was the terminal record, PROVIDER_MISSING_TERMINAL
141
+ // still fails the run cleanly.
136
142
  return {
137
- type: "error",
143
+ type: "warning",
144
+ code: rawEvent.code || "DECODER_ERROR",
138
145
  message: rawEvent.message || "Provider stream decoding failed",
139
- authError: false,
140
- usageLimit: false,
141
146
  };
142
147
  }
143
148
 
package/core/runner.js CHANGED
@@ -361,6 +361,8 @@ async function executeProviderInvocation(options = {}) {
361
361
  } else if (event.type === "error") {
362
362
  terminalSeen = true;
363
363
  rawErrors.push(event);
364
+ } else if (event.type === "warning") {
365
+ console.error("provider stream warning:", redactSensitive(String(event.message || event.code || "unknown")));
364
366
  }
365
367
  if (onEvent) {
366
368
  eventChain = eventChain.then(() => onEvent(event)).catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inetafrica/open-claudia",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "An always-on, provider-agnostic coding-agent harness for Claude Code and OpenAI Codex via chat",
5
5
  "main": "bot.js",
6
6
  "bin": {
@@ -24,6 +24,7 @@ assert.deepStrictEqual([...NORMALIZED_EVENT_TYPES].sort(), [
24
24
  "tool_end",
25
25
  "tool_start",
26
26
  "usage",
27
+ "warning",
27
28
  ].sort());
28
29
 
29
30
  const claudeState = createClaudeParserState();
@@ -154,10 +155,10 @@ assert.deepStrictEqual(codexAuth, [{
154
155
 
155
156
  const decoderError = { type: "decoder.error", code: "MALFORMED_JSON", message: "Malformed provider JSONL record" };
156
157
  assert.deepStrictEqual(normalizeClaudeEvent(decoderError, createClaudeParserState()), [{
157
- type: "error", message: "Malformed provider JSONL record", authError: false, usageLimit: false,
158
- }]);
158
+ type: "warning", code: "MALFORMED_JSON", message: "Malformed provider JSONL record",
159
+ }], "decoder failures must be non-fatal warnings, not run-killing errors");
159
160
  assert.deepStrictEqual(normalizeCodexEvent(decoderError, createCodexParserState()), [{
160
- type: "error", message: "Malformed provider JSONL record", authError: false, usageLimit: false,
161
+ type: "warning", code: "MALFORMED_JSON", message: "Malformed provider JSONL record",
161
162
  }]);
162
163
 
163
164
  assert.deepStrictEqual(normalizeClaudeEvent({ type: "future.claude.event" }, createClaudeParserState()), []);
@@ -32,11 +32,11 @@ assert.doesNotMatch(setup, /Your Claude Code bot is connected|Description=Claude
32
32
 
33
33
  const pkg = JSON.parse(read("package.json"));
34
34
  assert.match(pkg.description, /provider-agnostic coding-agent harness/i);
35
- // 3.0.8 approved by Sumeet 2026-07-12 (fast-path release after the v3.0.7
36
- // docker image was cancelled mid-build: same code as 3.0.7 — zombie-poll-loop
37
- // fix + turn-observer restore plus the pre-baked :base CI image and codex
38
- // gpt-5.6-sol-pro / max / ultra support).
39
- assert.strictEqual(pkg.version, "3.0.8", "release version must remain unchanged without explicit approval");
35
+ // 3.0.9 approved by Sumeet 2026-07-12 ("ok then please fix that"): decoder
36
+ // LINE_TOO_LARGE/MALFORMED_JSON downgraded to non-fatal warnings and the JSONL
37
+ // line cap raised 1MB→16MB after a base64-image tool result killed rahil's
38
+ // live turn on v3.0.8.
39
+ assert.strictEqual(pkg.version, "3.0.9", "release version must remain unchanged without explicit approval");
40
40
  for (const keyword of ["claude", "codex", "coding-agent", "provider-agnostic"]) {
41
41
  assert.ok(pkg.keywords.includes(keyword), `package keyword missing: ${keyword}`);
42
42
  }
@@ -232,8 +232,29 @@ async function main() {
232
232
  proc.stdout.end();
233
233
  proc.emit("close", 0, null);
234
234
  const malformed = await malformedRun;
235
- assert.strictEqual(malformed.ok, false);
236
- assert.match(malformed.error.message, /Malformed provider JSONL record/);
235
+ // A single bad record is skipped (warning), not fatal: a >1MB base64-image
236
+ // tool result killed a healthy live turn on v3.0.8.
237
+ assert.strictEqual(malformed.ok, true, "one undecodable record must not fail a run that reached its terminal event");
238
+ assert.strictEqual(malformed.text, "fixture");
239
+ }
240
+
241
+ {
242
+ // But if the stream NEVER recovers a terminal event, the run still fails.
243
+ const proc = fakeChild();
244
+ const lostTerminalRun = executeProviderInvocation({
245
+ runContext: context(),
246
+ provider: provider(),
247
+ invocation: invocation(),
248
+ cwd: "/fixture/project",
249
+ spawnProcess: () => proc,
250
+ cleanup: async () => {},
251
+ });
252
+ proc.stdout.write("{not-json}\n");
253
+ proc.stdout.end();
254
+ proc.emit("close", 0, null);
255
+ const lostTerminal = await lostTerminalRun;
256
+ assert.strictEqual(lostTerminal.ok, false);
257
+ assert.match(lostTerminal.error.message, /terminal/i);
237
258
  }
238
259
 
239
260
  {
@@ -3,7 +3,13 @@
3
3
  "use strict";
4
4
 
5
5
  const assert = require("assert");
6
- const { createJsonlDecoder } = require("./core/providers/events");
6
+ const { createJsonlDecoder, DEFAULT_MAX_LINE_BYTES } = require("./core/providers/events");
7
+
8
+ assert.strictEqual(
9
+ DEFAULT_MAX_LINE_BYTES,
10
+ 16 * 1024 * 1024,
11
+ "default line cap must fit base64-image tool results (1MB cap killed live image turns in v3.0.8)",
12
+ );
7
13
 
8
14
  const unicodeEvent = { type: "fixture", text: "café 👋" };
9
15
  const unicodeLine = Buffer.from(`${JSON.stringify(unicodeEvent)}\n`, "utf8");