FFFF Run cache can return a stale result when a Connection is reconfigured in place · Issue #45 · kiran-brahma/writing-tool · GitHub
[go: up one dir, main page]

Skip to content

Run cache can return a stale result when a Connection is reconfigured in place #45

Closed

Description

@kiran-brahma

What

runCacheKey keys on the fields that shape a Pass, but a Connection contributes three more
wire-shaping fields that are not in the key. The doc comment above RunCacheKeyInput and the
behaviour disagree.

  • src/core/runCache.ts — runCacheKey hashes canonicalHash, passId, promptHash, connectionId, protocol, baseUrl, model, screeningFrame, characterLimit, voiceList, target.
  • src/core/modelCall.ts:74 sends maxOutputTokens ?? connection.maxOutputTokens.
  • src/core/modelCall.ts:79 sends connection.reasoningEffort.
  • src/wire/protocols.ts:63 merges connection.extraHeaders into every request.

All three are editable in place under the same Connection id from the Connections panel.

Impact

A writer runs a Pass, then raises the output ceiling (or turns reasoning effort on, or adds an
X-Tenant header a proxy requires) and runs again. runModelPassNow finds the old entry and
resultFromCache returns the previous Findings without calling the Provider. The change looks
ignored, and there is no way to force a re-run short of editing the Document.

This is the same class of bug the #16 fixes addressed for Protocol and base URL — which is why
those two are in the key.

Fix

Add the three fields to RunCacheKeyInput and to the key array. extraHeaders is a record, so
hash its entries in a stable order rather than trusting JSON.stringify key order.

Where the test goes

src/core/runCache.test.ts — a case per field asserting a cache miss when it changes.

Origin

Found by the Thermos review (thermo-nuclear, core/wire).

Activity

  1. added a commit that references this issue on Sep 26, 2026
    42d9d3f
  2. kiran-brahma commented on Sep 26, 2026

    @kiran-brahma
    OwnerAuthor

    Fixed in #74 (merged into v1.3): maxOutputTokens, reasoningEffort and a sorted hash of extraHeaders are now in the run-cache key, with a miss test per field.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentSpec is ready for an agent to implement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0