@koda-sl/baker-bridge 0.71.0 → 0.72.0-dev.873c8c2cc

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/README.md CHANGED
@@ -172,7 +172,7 @@ the account setting is then the only off-switch.
172
172
 
173
173
  ## In-process MCP server (`baker_ui`)
174
174
 
175
- Every turn also carries an in-process SDK MCP server named `baker_ui` hosting interactive dashboard tools. Its first tool, `request_tag_input`, is the **blocking secure tag form**: the agent invokes it when a marketing tag needs secret values (API keys, access tokens, OAuth connections). The bridge intercepts the call in `canUseTool` (same pattern as `AskUserQuestion`), POSTs `/api/chat/tag-input-request` to Convex so the dashboard renders the form, and suspends the turn until Convex delivers the resolution via `POST /tag-input-decision`. Secret values flow dashboard → Convex tag draft directly; the bridge and the model only ever see the redacted result (`{ status, ref, type, identifier, secretFieldsSet }`). Secret values a model puts into `prefilledConfig` are stripped bridge-side (and again backend-side) — their names become requested fields instead. Live wait matches `AskUserQuestion` (15 min); like all blocking prompts, the form itself never expires — the thread parks and a later submission recovers the turn. It is **not** a connection route: a `googleTagManager` tag is the container snippet on the site, while the Tag Manager connection that unlocks the container's contents also has to name a container — which this form cannot do — so `oauthProviderId` is not requestable there and the backend rejects it, pointing the agent at `request_connection`.
175
+ Every turn also carries an in-process SDK MCP server named `baker_ui` hosting interactive dashboard tools. Its first tool, `request_tag_input`, is the **blocking secure tag form**: the agent invokes it when a marketing tag needs secret values (API keys, access tokens, OAuth connections). The bridge intercepts the call in `canUseTool` (same pattern as `AskUserQuestion`), POSTs `/api/chat/tag-input-request` to Convex so the dashboard renders the form, and suspends the turn until Convex delivers the resolution via `POST /tag-input-decision`. Secret values flow dashboard → Convex tag draft directly; the bridge and the model only ever see the redacted result (`{ status, ref, type, identifier, secretFieldsSet }`). Secret values a model puts into `prefilledConfig` are stripped bridge-side (and again backend-side) — their names become requested fields instead. `prefilledConfig` keys must be real config fields of the tag type (the tool description lists them per type); a call that invents field names is denied with the valid ones, because such a key renders nowhere in the form and would otherwise fail at stage time, after the user already approved. Live wait matches `AskUserQuestion` (15 min); like all blocking prompts, the form itself never expires — the thread parks and a later submission recovers the turn. It is **not** a connection route: a `googleTagManager` tag is the container snippet on the site, while the Tag Manager connection that unlocks the container's contents also has to name a container — which this form cannot do — so `oauthProviderId` is not requestable there and the backend rejects it, pointing the agent at `request_connection`.
176
176
 
177
177
  Its second tool, `request_flow_input`, is the **blocking form-configuration form**: the agent invokes it to configure the confidential parts of a flow ("Form") it cannot author itself — side-effect credentials/connections (`encryptedConfig`, `oauthProviderId`) and widget third-party field definitions (`nodeData.form.external` for HubSpot/Calendly/HighLevel/SavvyCal). The agent authors the surrounding structure in `_data.json` and references it by `nodeId`/`sideEffectId`. Same `canUseTool` park pattern: the bridge POSTs `/api/chat/flow-input-request`, the dashboard renders a tabbed form (secret inputs / OAuth connect+account picker / live resource picker), and on submit Convex delivers the resolved values to `POST /flow-input-decision`. Unlike tags, the resolved values are written **into the branch flow file** through the encrypting `writeFlow` (read → patch node/side-effect → write); the model only ever sees the redacted `{ status, nodeId, sideEffectId?, secretFieldsSet, note }`. Leaked secret values in `prefilledConfig` are stripped bridge-side (and again backend-side). Live wait matches `AskUserQuestion` (15 min); like all blocking prompts, the form itself never expires — the thread parks and a later submission recovers the turn.
178
178
 
@@ -298,8 +298,19 @@ Convex action ──POST /message/async──▶ Bridge AgentSession
298
298
  - **Context window usage** is relayed after every turn to `POST
299
299
  /api/chat/context-usage` as `{ tokens, window }`. Occupied `tokens` come from
300
300
  the **last main-conversation request's own usage** (`input_tokens +
301
- cache_read_input_tokens + cache_creation_input_tokens` off that assistant
302
- message) the real fill of the window at that request. The bridge does *not*
301
+ cache_read_input_tokens + cache_creation_input_tokens`) the real fill of the
302
+ window at that request. It is read from **two** places, because neither is
303
+ reliable alone: the assembled assistant message, and the raw
304
+ `message_delta` stream event (`streamEventContextUsage`). Anthropic reports a
305
+ request's input counts on `message_start`, which is where the runtime builds
306
+ the message's `usage` from — but the OpenRouter passthrough sends
307
+ `message_start` empty and puts the real numbers on `message_delta`, so the
308
+ assistant message arrives all zeros. Reading only the message meant the meter
309
+ never had a single reading in production: 3,910 assistant messages in one day,
310
+ every one reporting zero input tokens, so no chat ever stored a
311
+ `contextUsage` and the meter never rendered. A zero from either source is
312
+ ignored rather than written, so the meter holds its last real value instead of
313
+ resetting. The bridge does *not*
303
314
  use the turn `result`'s per-model token totals: those aggregate every API
304
315
  round-trip in the turn (one per tool call, plus any same-model subagent work),
305
316
  so summing them inflates the reading by roughly the number of tool calls and
@@ -308,7 +319,11 @@ Convex action ──POST /message/async──▶ Bridge AgentSession
308
319
  messages count). The `window` is the model's **real OpenRouter context
309
320
  length**, resolved from the model id (`contextWindowForModel` in
310
321
  `model-capabilities.ts`): opus 5, opus 4.6, sonnet 4.6 and sonnet 5 are 1M, haiku 4.5
311
- is 200k. We resolve it ourselves because the runtime reaches these models through
322
+ is 200k and resolved from **the model that actually served the request**,
323
+ which is not always the session's. A skill can pin its own model for the turn
324
+ (publish pins Haiku 4.5), and measuring such a turn against the session's 1M
325
+ reads a third full when it is in fact over — the mismatch that hid the publish
326
+ failure. We resolve it ourselves because the runtime reaches these models through
312
327
  the OpenRouter passthrough (`ANTHROPIC_BASE_URL=openrouter.ai`) while the CLI
313
328
  resolves the window from its own bundled catalog, which is keyed to the
314
329
  first-party API. There they disagree: the catalog lists opus 4.6 and sonnet 4.6
@@ -372,22 +387,44 @@ Convex action ──POST /message/async──▶ Bridge AgentSession
372
387
  would push the command off the front and it would land as ordinary message
373
388
  text. `/compact` resumes the live session and asks the SDK to summarize older
374
389
  turns.
375
- - **Publish never summarizes as a precaution.** Auto-compact fires on a
376
- *threshold*, not on a real overflow, so on a long chat every Publish click paid
377
- for a summary before anything happened the user watched "Summarizing this chat
378
- to free up space…" instead of a publish starting. A `/publish` turn therefore
379
- runs with `settings.autoCompactEnabled: false`: same session, same context, it
380
- just starts working. If a request is then genuinely refused for size
381
- (`isContextOverflowError` Anthropic's `prompt is too long`, OpenRouter's
382
- `maximum context length`), the turn retries **once** with compaction allowed,
383
- resuming the in-flight publish session (forked) so the steps already completed
384
- are not repeated. Compaction still happens only when publishing is otherwise
385
- impossible, which is the one case where it buys something.
390
+ - **Publish runs detached from the chat session.** `/publish` neither resumes the
391
+ chat's session nor replaces it on the way out (`detachedSession` on the
392
+ attempt): it starts empty, every time, whatever the conversation is doing.
393
+ - **Why.** The publish skill pins its own model — Haiku 4.5, a genuine 200k
394
+ window — while the chat runs on a 1M one. Resuming the chat's session
395
+ therefore handed a conversation sized for 1M to a model with a fifth of the
396
+ room. Measured on a failure in production: the last chat request was 356,707
397
+ tokens (36% of its own window, 78% *over* the publish model's), and the
398
+ provider refused the publish pre-flight while the chat's own meter showed
399
+ plenty of space. Summarizing could not rescue it either the summary request
400
+ has to send the same conversation. Detached publishes measured ~51k against
401
+ the same 200k window.
402
+ - **It costs nothing**, because publish does not read the conversation: the
403
+ skill says so outright ("Do not reference or act on prior conversation
404
+ context"), and it works from the state of the workspace — scripts, git, and
405
+ the files verify complains about.
406
+ - **The chat's session is left intact**, on success *and* on failure. Handing
407
+ publish's throwaway session back as the thread's boundary would make the next
408
+ message resume a transcript holding one `/publish` and nothing else, and
409
+ clearing the boundary on a failed publish would charge the user their
410
+ conversation for a publish that did not happen.
411
+ - **Publish still never summarizes as a precaution.** Auto-compact fires on a
412
+ *threshold*, not on a real overflow, so a long chat once paid for a summary
413
+ before anything happened — the user watched "Summarizing this chat to free up
414
+ space…" instead of a publish starting. A `/publish` turn runs with
415
+ `settings.autoCompactEnabled: false`, because it still runs a build and a
416
+ verify inside its own session and that output alone can cross the threshold.
417
+ If the turn's *own* work then overflows (`isContextOverflowError` — Anthropic's
418
+ `prompt is too long`, OpenRouter's `maximum context length`), it retries once
419
+ with compaction allowed, resuming the in-flight session (forked) so the steps
420
+ already completed are not repeated. Gated on work having been produced
421
+ (`resumeSessionAt`), which is the only state where a summary has anything to
422
+ shrink — before that, the turn stops rather than re-sending a request the
423
+ provider just refused.
386
424
  - **The refusal itself is never shown.** The CLI renders a refused request as an
387
425
  assistant message *before* the query throws, and relayed text is never
388
- retracted — so the recovery above used to leave a raw `Prompt is too long` in
389
- the chat, above the publish that then succeeded. While a publish turn is still
390
- owed its compaction retry, that message is dropped outright
426
+ retracted — so recovery used to leave a raw `Prompt is too long` in the chat,
427
+ above the publish that then succeeded. That message is dropped outright
391
428
  (`isContextOverflowRefusal`: a single text block, ≤200 chars, leading with the
392
429
  provider's error *and* matching `isContextOverflowError` — so `API Error: 400 …
393
430
  prompt is too long` is dropped, `API Error: 500` and an answer that merely
@@ -397,8 +434,9 @@ Convex action ──POST /message/async──▶ Bridge AgentSession
397
434
  changes the leftover cannot come back as the turn's end-of-turn post. Dropping
398
435
  it before the session observer also stops it from counting as
399
436
  work done, which would otherwise make the retry resume with "continue where you
400
- left off" instead of delivering the `/publish` the turn still owes. If the
401
- retry fails too, the error surfaces normally.
437
+ left off" instead of delivering the `/publish` the turn still owes. A turn that
438
+ cannot recover reports the failure once, in product language — the provider's
439
+ wording never reaches the chat.
402
440
  - **Compaction progress + confirmation.** A compaction summarizes the session to
403
441
  free context. A manual `/compact` turn emits no assistant text, so it would
404
442
  otherwise complete with nothing visible; an automatic compaction happens
@@ -133,7 +133,7 @@ export type BridgeJobRelay = {
133
133
  heartbeat(target: CallbackTarget): Promise<void>;
134
134
  compaction(target: CallbackTarget, state: "compacting" | "done"): Promise<void>;
135
135
  contextUsage(target: CallbackTarget, usage: ContextUsage): Promise<void>;
136
- contextSource(target: CallbackTarget, source: "local_resume" | "rehydrated_missing_session" | "rehydrated_invalid_resume" | "rehydrated_repaired_tool_state" | "rehydration_failed", metadata: Record<string, unknown>): Promise<void>;
136
+ contextSource(target: CallbackTarget, source: "local_resume" | "rehydrated_missing_session" | "rehydrated_invalid_resume" | "rehydrated_repaired_tool_state" | "detached_publish" | "rehydration_failed", metadata: Record<string, unknown>): Promise<void>;
137
137
  complete(target: CallbackTarget, outcome: BridgeJobOutcome): Promise<void>;
138
138
  };
139
139
  export type AgentSdkQuery = AsyncIterable<SDKMessage> & {
@@ -256,6 +256,20 @@ export declare class BridgeJobExecutor {
256
256
  private drainQuery;
257
257
  private createStallDetector;
258
258
  private consumeSdkMessage;
259
+ /**
260
+ * Surface how full the conversation's context is, at turn end.
261
+ *
262
+ * Tokens come from the last main-conversation request's own usage — the real
263
+ * occupancy of the window at that request. We deliberately do NOT use the
264
+ * result's per-model token totals: those aggregate every API round-trip in the
265
+ * turn (one per tool call, plus any same-model subagent work), so a handful of
266
+ * tool calls inflates them past the window and pins the meter at 100% on an
267
+ * almost-empty chat. The window is the model's real OpenRouter context length
268
+ * (opus/sonnet 4.6 = 1M); we resolve it from the model id because the runtime
269
+ * under-reports it through the OpenRouter passthrough, falling back to the
270
+ * reported window for unknown models. A relay failure must never fail the turn.
271
+ */
272
+ private publishContextUsage;
259
273
  private handleMessage;
260
274
  private handleSystemMessage;
261
275
  private handleContentBlockStart;
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-job.d.ts","sourceRoot":"","sources":["../../src/hono/bridge-job.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAoB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAAE,KAAK,SAAS,EAAwE,MAAM,kBAAkB,CAAC;AACxH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAE/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,YAAY,EAKlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAKL,KAAK,kBAAkB,EASxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,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B;YA0DrB,sBAAsB;YAkDtB,4BAA4B;YAyC5B,gBAAgB;CAwC/B"}
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
3
3
  import { isAbsolute, join, relative, resolve } from "node:path";
4
4
  import { applyInFlightTask, applyTaskLifecycleMessage, backgroundTaskSnapshot } from "./agent-tasks.js";
5
5
  import { CONNECTION_INPUT_TOOL_NAME, normalizeConnectionInputToolInput, } from "./connection-input.js";
6
- import { messageContextTokens, pickContextWindow, turnContextUsage, } from "./context-usage.js";
6
+ import { messageContextTokens, pickContextWindow, streamEventContextUsage, turnContextUsage, } from "./context-usage.js";
7
7
  import { FLOW_INPUT_TOOL_NAME, normalizeFlowInputToolInput, sanitizeFlowRequests, } from "./flow-input.js";
8
8
  import { composioScopesToInvalidate, failedCustomServers, reportMcpInvalid, } from "./mcp-servers.js";
9
9
  import { autoCompactWindowForModel, betasForModel, contextWindowForModel } from "./model-capabilities.js";
@@ -13,7 +13,7 @@ import { bridgeRuntimeFiles } from "./runtime-files.js";
13
13
  import { applyCurrentSenderAttribution, buildCleanBoundary, buildRehydratedPrompt, compactionRetryAttempt, emptyInProgressSession, isContextOverflowError, isResumeSessionError, observeInProgressSession, prepareSessionAttempt, stallContinuationAttempt, } from "./session-continuity.js";
14
14
  import { readSessionSkills } from "./session-skills.js";
15
15
  import { verbatimSlashCommand } from "./slash-commands.js";
16
- import { createBakerUiServer, normalizeTagInputToolInput, sanitizeTagChanges, TAG_INPUT_TOOL_NAME, } from "./tag-input.js";
16
+ import { createBakerUiServer, normalizeTagInputToolInput, sanitizeTagChanges, TAG_INPUT_TOOL_NAME, unknownPrefillMessage, } from "./tag-input.js";
17
17
  import { addQueryModelUsage, queryModelUsage, turnModelUsageList } from "./turn-model-usage.js";
18
18
  export function parsePlanDecision(value) {
19
19
  if (!value || typeof value !== "object") {
@@ -126,7 +126,7 @@ function createBridgeJobState() {
126
126
  inProgressSession: emptyInProgressSession(),
127
127
  observedCostUsd: 0,
128
128
  controlChannelDenies: 0,
129
- compactionRetryOwed: false,
129
+ detachedSession: false,
130
130
  modelUsageTotals: new Map(),
131
131
  queryModelUsage: new Map(),
132
132
  };
@@ -152,6 +152,18 @@ function isUserVisibleSdkMessage(msg) {
152
152
  const delta = event.delta;
153
153
  return delta?.type === "text_delta" && typeof delta.text === "string" && delta.text.length > 0;
154
154
  }
155
+ // What the user reads when a turn ends on a size refusal the restart could not
156
+ // save. "Prompt is too long" is the provider talking to us, not the product
157
+ // talking to a marketer: it names nothing they did and nothing they can do. The
158
+ // failed turn clears the session, so sending again genuinely does start from the
159
+ // shorter rehydrated history — which is the action this asks for.
160
+ const CONTEXT_OVERFLOW_MESSAGE = "This chat has grown too long to continue in one step. Send your message again — it will pick up from a shorter version of this conversation.";
161
+ function userFacingTurnError(message) {
162
+ if (isContextOverflowError(message)) {
163
+ return CONTEXT_OVERFLOW_MESSAGE;
164
+ }
165
+ return enrichImageError(message);
166
+ }
155
167
  function enrichImageError(message) {
156
168
  if (!message.toLowerCase().includes("could not process image")) {
157
169
  return message;
@@ -586,17 +598,39 @@ function createTurnEndController(job, query, closeQuery, timings) {
586
598
  }
587
599
  // Track the occupancy of the last main-conversation request. The meter reads a
588
600
  // single request's usage, not the turn's aggregate totals — and only from the
589
- // main conversation, so subagent work never pollutes it. Some OpenRouter
590
- // provider routes (observed: Amazon Bedrock) report all-zero usage on the
591
- // assistant message; zero is never a real occupancy, so keep the previous
592
- // reading rather than overwrite the meter with 0.
601
+ // main conversation, so subagent work never pollutes it.
602
+ //
603
+ // Two sources, because neither is reliable alone. The assembled assistant
604
+ // message is the natural one, but through the OpenRouter passthrough every
605
+ // provider route we run reports it as all zeros: the runtime builds that usage
606
+ // from `message_start`, which the passthrough sends empty, and puts the real
607
+ // numbers on `message_delta` instead. Production showed the cost of trusting
608
+ // only the message — 3,910 assistant messages in a day, every one reporting zero
609
+ // input tokens, so the meter had no reading to show and never appeared at all.
610
+ //
611
+ // Zero is never a real occupancy, so a zero from either source keeps the
612
+ // previous reading rather than resetting the meter.
593
613
  function trackMainRequestUsage(state, msg) {
614
+ if (msg.type === "stream_event") {
615
+ if (msg.parent_tool_use_id) {
616
+ return;
617
+ }
618
+ const event = msg.event;
619
+ recordMainRequestUsage(state, streamEventContextUsage(event), event?.message?.model);
620
+ return;
621
+ }
594
622
  if (msg.type !== "assistant" || msg.parent_tool_use_id || msg.subagent_type) {
595
623
  return;
596
624
  }
597
- const usage = msg.message.usage;
625
+ const message = msg.message;
626
+ recordMainRequestUsage(state, message.usage, message.model);
627
+ }
628
+ function recordMainRequestUsage(state, usage, model) {
598
629
  if (usage && messageContextTokens(usage) > 0) {
599
630
  state.lastMainRequestUsage = usage;
631
+ if (typeof model === "string" && model.length > 0) {
632
+ state.lastMainRequestModel = model;
633
+ }
600
634
  }
601
635
  }
602
636
  function classifyDirtyReason(error, controls) {
@@ -648,6 +682,7 @@ export class BridgeJobExecutor {
648
682
  const loaded = await this.loadTrustedBoundary(job, controls);
649
683
  attempt = prepareSessionAttempt({ requestPrompt, history: job.history, loaded });
650
684
  state.usedBoundary = attempt.usedBoundary;
685
+ state.detachedSession = attempt.detachedSession === true;
651
686
  result.attemptedRehydration = attempt.attemptedRehydration;
652
687
  this.recordAttemptContextSource(job, attempt);
653
688
  result = await this.runAttempt(job, controls, state, attempt);
@@ -710,12 +745,19 @@ export class BridgeJobExecutor {
710
745
  break;
711
746
  }
712
747
  catch (error) {
713
- // The turn ran with compaction switched off (publish) and the request was
714
- // refused for size summarizing is now the only way it can proceed, so
715
- // allow it and resend. Once per turn: the retry has compaction on, so a
716
- // second overflow is a real failure, not something to loop on.
717
- if (current.autoCompact === false && isContextOverflowError(error) && controls.isActive()) {
718
- console.error(`[BridgeJob] publish no longer fits the context window compacting for thread ${job.threadId}`);
748
+ // The publish turn's OWN work no longer fits. Not the conversation
749
+ // publish never carries it (`prepareSessionAttempt` runs it detached)
750
+ // but a build plus a verify inside one session, which is the only thing
751
+ // left that a summary can actually shrink. Gated on work having been
752
+ // produced, because that is what makes the session worth keeping;
753
+ // summarizing an empty one could not free a single token. Once per turn:
754
+ // the retry runs with compaction on, so a second overflow is a real
755
+ // failure rather than something to loop on.
756
+ if (isContextOverflowError(error) &&
757
+ controls.isActive() &&
758
+ current.autoCompact === false &&
759
+ state.inProgressSession.resumeSessionAt) {
760
+ console.error(`[BridgeJob] publish outgrew the context window mid-turn — compacting for ${job.threadId}`);
719
761
  current = compactionRetryAttempt(current, state.inProgressSession);
720
762
  continue;
721
763
  }
@@ -742,7 +784,13 @@ export class BridgeJobExecutor {
742
784
  await this.clearIfDirty(job, controls, state, "abort");
743
785
  return { kind: "cancelled", costUsd, model: state.model, modelUsage };
744
786
  }
745
- const cleanBoundary = buildCleanBoundary({ inProgress: state.inProgressSession, nowMs: this.now() });
787
+ // A detached turn (publish) ran in a session of its own. Handing that session
788
+ // back as the thread's boundary would make the next chat message resume a
789
+ // transcript containing one `/publish` and nothing else — the conversation,
790
+ // still perfectly good, replaced by the turn that was told not to read it.
791
+ const cleanBoundary = state.detachedSession
792
+ ? undefined
793
+ : buildCleanBoundary({ inProgress: state.inProgressSession, nowMs: this.now() });
746
794
  return { kind: "completed", costUsd, model: state.model, modelUsage, cleanBoundary };
747
795
  }
748
796
  errorOutcome(job, controls, state, result, error) {
@@ -764,13 +812,19 @@ export class BridgeJobExecutor {
764
812
  costUsd: result.costUsd,
765
813
  model,
766
814
  modelUsage,
767
- errors: [enrichImageError(errorMessage(error))],
815
+ errors: [userFacingTurnError(errorMessage(error))],
768
816
  };
769
817
  }
770
818
  resultWithObservedCost(result, state) {
771
819
  return { ...result, costUsd: Math.max(result.costUsd, state.observedCostUsd) };
772
820
  }
773
821
  recordAttemptContextSource(job, attempt) {
822
+ if (attempt.contextSource === "detached_publish") {
823
+ void this.relay.contextSource({ threadId: job.threadId, turnId: job.turnId }, "detached_publish", {
824
+ historyEntryCount: job.history?.entries.length ?? 0,
825
+ });
826
+ return;
827
+ }
774
828
  if (attempt.contextSource === "local_resume") {
775
829
  void this.relay.contextSource({ threadId: job.threadId, turnId: job.turnId }, "local_resume", {
776
830
  historyEntryCount: job.history?.entries.length ?? 0,
@@ -861,7 +915,6 @@ export class BridgeJobExecutor {
861
915
  // it (they are cumulative); it is folded into the turn totals in `finally`,
862
916
  // so a stall that lands after a clean result still contributes its snapshot.
863
917
  state.queryModelUsage = new Map();
864
- state.compactionRetryOwed = attempt.autoCompact === false;
865
918
  const mcpServers = await this.resolveMcpServers(job);
866
919
  const skills = await readSessionSkills(bridgeRuntimeFiles.projectRoot());
867
920
  const autoCompactWindow = autoCompactWindowForModel(model);
@@ -1108,14 +1161,15 @@ export class BridgeJobExecutor {
1108
1161
  return costUsd;
1109
1162
  }
1110
1163
  controls.markEvent?.();
1111
- // Drop the size refusal outright while a compaction retry is still owed: the
1112
- // turn recovers on the next attempt, so relaying it would leave a raw
1113
- // provider error in the chat. Dropping it before `observeInProgressSession`
1114
- // also keeps it from setting `resumeSessionAt` — the refusal is not work the
1115
- // agent did, and counting it as such would make the retry resume with
1116
- // "continue where you left off" instead of delivering the `/publish` the turn
1117
- // still owes.
1118
- if (state.compactionRetryOwed && isContextOverflowRefusal(msg)) {
1164
+ // Drop the size refusal outright. A recovered turn must not leave a raw
1165
+ // provider error sitting above the work that then succeeded, and a turn that
1166
+ // fails anyway says so once, in product language, through the error outcome —
1167
+ // never twice, and never in the provider's words. Dropping it before
1168
+ // `observeInProgressSession` also keeps it from setting `resumeSessionAt`
1169
+ // the refusal is not work the agent did, and counting it as such would send
1170
+ // the retry a "continue where you left off" note instead of the `/publish`
1171
+ // the turn still owes.
1172
+ if (isContextOverflowRefusal(msg)) {
1119
1173
  // Today the refusal is synthetic — the request is rejected pre-flight, so
1120
1174
  // no deltas precede it and `turnText` is empty. Clearing it anyway is what
1121
1175
  // makes the drop hold if that ever changes: streamed text survives the
@@ -1151,22 +1205,7 @@ export class BridgeJobExecutor {
1151
1205
  if (snapshot.size > 0) {
1152
1206
  state.queryModelUsage = snapshot;
1153
1207
  }
1154
- // Surface how full the conversation's context is. Tokens come from the last
1155
- // main-conversation request's own usage — the real occupancy of the window
1156
- // at that request. We deliberately do NOT use the result's per-model token
1157
- // totals: those aggregate every API round-trip in the turn (one per tool
1158
- // call, plus any same-model subagent work), so a handful of tool calls
1159
- // inflates them past the window and pins the meter at 100% on an almost-
1160
- // empty chat. The window is the model's real OpenRouter context length
1161
- // (opus/sonnet 4.6 = 1M); we resolve it from the model id because the
1162
- // runtime under-reports it through the OpenRouter passthrough, falling back
1163
- // to the reported window for unknown models. A relay failure must never
1164
- // fail the turn.
1165
- const window = contextWindowForModel(state.model) ?? pickContextWindow(msg.modelUsage);
1166
- const contextUsage = turnContextUsage(state.lastMainRequestUsage, window);
1167
- if (contextUsage) {
1168
- await this.relay.contextUsage({ threadId: job.threadId, turnId: job.turnId }, contextUsage);
1169
- }
1208
+ await this.publishContextUsage(job, state, msg.modelUsage);
1170
1209
  const resultError = sdkResultError(msg);
1171
1210
  if (resultError) {
1172
1211
  await this.clearIfDirty(job, controls, state, "result_error");
@@ -1180,6 +1219,38 @@ export class BridgeJobExecutor {
1180
1219
  await this.handleMessage(job, state, msg);
1181
1220
  return costUsd;
1182
1221
  }
1222
+ /**
1223
+ * Surface how full the conversation's context is, at turn end.
1224
+ *
1225
+ * Tokens come from the last main-conversation request's own usage — the real
1226
+ * occupancy of the window at that request. We deliberately do NOT use the
1227
+ * result's per-model token totals: those aggregate every API round-trip in the
1228
+ * turn (one per tool call, plus any same-model subagent work), so a handful of
1229
+ * tool calls inflates them past the window and pins the meter at 100% on an
1230
+ * almost-empty chat. The window is the model's real OpenRouter context length
1231
+ * (opus/sonnet 4.6 = 1M); we resolve it from the model id because the runtime
1232
+ * under-reports it through the OpenRouter passthrough, falling back to the
1233
+ * reported window for unknown models. A relay failure must never fail the turn.
1234
+ */
1235
+ async publishContextUsage(job, state, modelUsage) {
1236
+ const window = contextWindowForModel(state.lastMainRequestModel) ??
1237
+ contextWindowForModel(state.model) ??
1238
+ pickContextWindow(modelUsage);
1239
+ const contextUsage = turnContextUsage(state.lastMainRequestUsage, window);
1240
+ if (contextUsage) {
1241
+ await this.relay.contextUsage({ threadId: job.threadId, turnId: job.turnId }, contextUsage);
1242
+ return;
1243
+ }
1244
+ if (state.postedAssistantEvent) {
1245
+ // A turn that produced assistant output but no occupancy reading means every
1246
+ // source we know of came back empty. That is how the meter stayed dead
1247
+ // without anyone noticing: silence looked exactly like a quiet chat. The
1248
+ // cause is a shape mismatch upstream, not something a test can catch, so it
1249
+ // has to be visible from the outside — grep the sandbox logs for this line
1250
+ // before concluding the meter "just doesn't show".
1251
+ console.error(`[BridgeJob] no context occupancy reported this turn for thread ${job.threadId}`);
1252
+ }
1253
+ }
1183
1254
  async handleMessage(job, state, msg) {
1184
1255
  const target = { threadId: job.threadId, turnId: job.turnId };
1185
1256
  if (msg.type === "system") {
@@ -1270,6 +1341,12 @@ export class BridgeJobExecutor {
1270
1341
  await this.relay.assistantEvent({ threadId: job.threadId, turnId: job.turnId }, syntheticAssistant, state.model);
1271
1342
  }
1272
1343
  async clearIfDirty(job, controls, state, reason) {
1344
+ // A detached turn never touched the stored session, so nothing it does can
1345
+ // have dirtied it. Clearing here would take the conversation away as the
1346
+ // price of a failed publish — the session id this turn saw is its own.
1347
+ if (state.detachedSession) {
1348
+ return;
1349
+ }
1273
1350
  if (!state.usedBoundary && !state.inProgressSession.sawSessionId) {
1274
1351
  return;
1275
1352
  }
@@ -1350,6 +1427,14 @@ export class BridgeJobExecutor {
1350
1427
  message: "request_tag_input requires `changes: [{ mode, tagType, ref?, prefilledConfig?, requestedSecretFields?, message? }]` with at least one valid entry — retry with that shape.",
1351
1428
  };
1352
1429
  }
1430
+ // Invented field names never reach the form: they render nowhere, so the
1431
+ // user would approve a tab missing whatever the model meant to set and the
1432
+ // backend would reject the tab as "Unknown fields" after the click. Deny
1433
+ // while the model can still fix it.
1434
+ const unknownFields = unknownPrefillMessage(changes);
1435
+ if (unknownFields) {
1436
+ return { behavior: "deny", message: unknownFields };
1437
+ }
1353
1438
  // Strip any secret values the model tried to prefill from each change; their
1354
1439
  // names still reach the user as requested fields. The backend strips again.
1355
1440
  const sanitizedChanges = sanitizeTagChanges(changes);