Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

- Verify the November upstream surface (v3.17.2-v3.18.2): the new
credential-cipher reverse request and the plugins-degraded notification
degrade cleanly - the bridge answers the unknown request with a typed
error and ignores the unknown notification, leaving the session fully
usable for the next turn.

## 0.16.0 — 2026-11-15

- Stop unanswered ZCode questions from duplicating in the chat. While an
Expand Down
35 changes: 5 additions & 30 deletions knowledge/decisions/feature-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ schema-validated but not yet eyeballed in an installed bb run, and
`threadPanelAction` is retired in newer SDK typings (migration needs an SDK
bump).

## Stage 10 — November upstream verification (v3.17.2–v3.18.2)
## Stage 10 — November upstream verification (v3.17.2–v3.18.2) — fixtures done 2026-11-22, live pass pending

Fixture-level degradation coverage is done; the live suite on Desktop
3.18.x remains and lands when the local app updates.

Upstream syncs `a9fe401`..`fec9759` (2026-11-03..13) add five protocol
methods (`plugins/readUserOptions`, `plugins/mentionItems`,
Expand All @@ -209,35 +212,7 @@ sign-in), smoke the workflow journal against the WebSearch-budget driver,
and refresh the pins in
[protocol contracts](../contracts/protocol-contracts.md) and the audit.

## Stage 11 — context composition to the rich context snapshot

The audit's long-standing "contextWindow delta accepts a rich snapshot the
plugin does not send" gap. Query
`v4/conversation/contextComposition` (same v4 read lane as `rowsRange`;
method-not-found on older CLIs degrades to today's plain delta) after a
turn settles and map it into the delta's `snapshot`:

- native items (`name` <=200 chars, <=50 per category) become entries
`{id, label, tokens}`;
- native fine categories (11 ids: `system_prompt`, `meta_user_context`,
`skills`, `tool_prompt`, `system_tool_schemas`, `mcp_tool_schemas`,
`app_tool_schemas`, `deferred_tool_schemas`, `reminders`,
`compact_summary`, `messages`) map to bb's four snapshot kinds:
conversation content (`messages`, `compact_summary`, `reminders`,
`meta_user_context`) to `used`, static overhead (`system_prompt`,
`tool_prompt`, `skills`, loaded tool schemas) to `reserved`,
`deferred_tool_schemas` to `deferred`; `free` stays computed from
`contextWindowTokens - usedTokens`;
- `usedTokens`/`contextWindowTokens` from the projection read that already
happens in `finishTurn`; `autoCompactAtTokens` from native metadata when
exposed, else `null`; `capturedAt`/`estimated`/`model`/
`providerSessionId`/`providerTurnId` filled by the bridge;
- revision guard: the query result carries a revision; a stale read (turn
settled again meanwhile) is dropped, not emitted.

Push variant (optional follow-up): subscribe to the
`contextCompositionChanged` notification for live updates between turns on
supported CLIs.
## Stage 11 — context composition to the rich context snapshot (next)

## Stage 12 — appControl investigation (decision required)

Expand Down
9 changes: 9 additions & 0 deletions knowledge/log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Knowledge log

## 2026-11-22 (November upstream verification)

- **Verified** the November upstream surface (v3.17.2-v3.18.2, sync
`fec9759`): fixture prompts prove the bridge survives the new unknown
reverse request (`interaction/requestCredentialCipher` - typed error
reply) and notification (`startup/pluginsDegraded` - ignored) with the
session fully usable afterwards. The wire surface the plugin speaks
(create/resume/preferences/v4 commands) is unchanged.

## 2026-11-22 (November upstream plan)

- **Researched** upstream v3.17.2–v3.18.2 (syncs `a9fe401`..`fec9759`):
Expand Down
62 changes: 61 additions & 1 deletion tests/bridge.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdtempSync } from "node:fs";
import { mkdtempSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { afterEach, expect, it } from "vitest";
Expand Down Expand Up @@ -294,6 +294,66 @@ it("joins re-announced native questions into one pending interaction", async ()
);
});

it("answers the unknown November reverse request with the typed fallback", async () => {
const h = harness();
const providerThreadId = await h.start();
await h.rpc("turn/start", {
threadId: "thread",
providerThreadId,
options,
clientRequestId: "creq_abcdefghij",
input: [{ type: "text", text: "unknown-rpc", mentions: [] }],
});
await h.until(() => h.deltas().some((d) => d.kind === "turn.boundary"));
// The fixture persists the envelope the bridge sent back for the
// credential-cipher request: the typed -32601 host fallback.
const envelope = JSON.parse(
readFileSync(join(h.cwd, `${providerThreadId}.unknown-rpc.json`), "utf8"),
);
expect(record(envelope.error)).toMatchObject({ code: -32601 });
});

it("ignores the unknown November notification and keeps the session usable", async () => {
const h = harness();
const providerThreadId = await h.start();
const reply = await h.rpc("turn/start", {
threadId: "thread",
providerThreadId,
options,
clientRequestId: "creq_abcdefghij",
input: [{ type: "text", text: "unknown-notification", mentions: [] }],
});
expect(reply.error).toBeUndefined();
await h.until(() => h.deltas().some((d) => d.kind === "turn.boundary"));
expect(h.deltas().find((d) => d.kind === "turn.boundary")).toMatchObject({
status: "completed",
});
const boundaries = h
.deltas()
.filter((d) => d.kind === "turn.boundary").length;
const next = await h.rpc("turn/start", {
threadId: "thread",
providerThreadId,
options,
clientRequestId: "creq_abcdefghik",
input: [{ type: "text", text: "hello", mentions: [] }],
});
expect(next.error).toBeUndefined();
// The reply only proves acceptance; wait for the follow-up turn to
// actually complete.
await h.until(
() =>
h.deltas().filter((d) => d.kind === "turn.boundary").length ===
boundaries + 1,
);
expect(
h
.deltas()
.filter((d) => d.kind === "turn.boundary")
.at(-1),
).toMatchObject({ status: "completed" });
});

it("settles interruption before replying, releases the child, and cold-resumes the same session", async () => {
const h = harness();
const providerThreadId = await h.start();
Expand Down
28 changes: 27 additions & 1 deletion tests/fixtures/fake-zcode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ async function run(p) {
sessions.get(sessionId).turn++;
event(sessionId, "turn.started", { inputId: p.inputId });
if (p.content === "hang") return;
if (p.content === "unknown-rpc") {
// November CLI surface the host does not implement: the bridge must
// reply with the typed -32601 fallback and the session must keep
// working. host() resolves only results, so capture the raw reply
// (error envelopes included) through the pending map and persist it
// for the test to assert.
const id = randomUUID();
const reply = await new Promise((resolve) => {
pending.set(id, (value) => resolve(value));
send({
id,
method: "interaction/requestCredentialCipher",
params: { sessionId, purpose: "fixture" },
});
});
writeFileSync(
join(process.cwd(), sessionId + ".unknown-rpc.json"),
JSON.stringify(reply ?? { missing: true }),
);
}
if (p.content === "unknown-notification") {
send({
method: "startup/pluginsDegraded",
params: { sessionId, degraded: ["fixture-plugin"] },
});
}
if (p.content === "crash") {
process.exitCode = 2;
input.close();
Expand Down Expand Up @@ -192,7 +218,7 @@ async function run(p) {
input.on("line", async (line) => {
const m = JSON.parse(line);
if (!m.method) {
pending.get(m.id)?.(m.result);
pending.get(m.id)?.(m.result ?? (m.error ? { error: m.error } : undefined));
pending.delete(m.id);
return;
}
Expand Down
Loading