Skip to content

fix(knowledge): scribe retries repeat the request after a lost response - #198030

Merged
jalehman merged 2 commits into
mainfrom
fix/knowledge-scribe-retry-identity
Nov 13, 2026
Merged

jalehman merged 2 commits into
mainfrom
fix/knowledge-scribe-retry-identity

Conversation

@jalehman

@jalehman jalehman commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #197391

What Problem This Solves

Fixes duplicate scribe update turns when Try again reaches the Gateway but its response is lost, and the update is sent again.

User Impact

Owners can retry automatic updates and run-message replacements after a lost response without starting a second turn for the same attempt. No stored-data format, permissions, generated run-message bytes, or visual presentation changes.

Why This Change Was Made

The final review of #197391 identified two P2s: late retries discarded their failed request identity, and new Granola instructions lacked an incident citation. This follow-up retains each retry identity until its send succeeds and adds the citation. The existing attempt map and replacement closure remain the owners; no new retry machinery or helpers.

The real-Gateway proof below found a third path: in the Control UI a lost response arrives as a dropped connection, and the page reconnects with a new plugin host. Attempts and pending updates were kept per host, so the reloaded page forgot the unsent retry and sent the update again under a new identity. They are now kept per Gateway (the Control UI base path), and Try again sends through the page that asks.

Evidence

Unit and static checks at 02995e6c49e7:

  • Lost-response regressions fail on the unmodified base, then pass. The reconnect regression (new host, same Gateway) fails on 457d4aa ("Updating…" with a third send) and passes with the fix.
  • 43 scribe-state, scribe-view and skill-packaging tests pass; extension source/test typechecks, touched-file oxlint/oxfmt, test-lines ratchet, baseline ratchets and git diff --check pass.
  • No visual change: the notices and buttons are the same; only which requests they send changed.

Real-Gateway proof on the Mac Studio

Isolated Gateways on loopback ports 19821–19823, each with its own state directory and token; real model turns through ClawRouter; headless Chromium driving the Control UI. The live fsn1 Gateway and the Studio's own Gateway were not touched. Builds: v2026.11.3 (847611dc), pre-#197391 main (69b3f27b), this PR (457d4aa and 02995e6). Each upgrade stopped the old Gateway, ran the new build's doctor --fix --yes --non-interactive on the same state, then started the new build.

1. Released scheduler storage → this PR (v2026.11.3 → 02995e6). Created through v2026.11.3's cron.add: a session:<key> cron job with tz, stagger, pacing, trigger, model, thinking, timeout, fallbacks, lightContext, toolsAllow [2 tools], delivery none and failure alert {after 3, cooldown, includeSkipped}; a paused isolated interval job with toolsAllow: [] and failure alert off; a main-session at reminder. A forced run succeeded on v2026.11.3. After the upgrade, all three jobs compared field-for-field equal (excluding run state and revision), the paused job stayed paused, and forced runs succeeded on the new build: the session job answered in agent:main:kn-lane1-target, the tool-less isolated job in a fresh cron:…:run:… session. (The built-in heartbeat-main record migrated to its current form, as main does; not touched by this PR.) v2026.11.3 has no Knowledge plugin, so this lane exercises scheduler storage only.

2. Pre-#197391 Scribes → this PR (main to main; run twice, on 457d4aa and on 02995e6). On 69b3f27b, the Scribes page started Knowledge Consolidation (setup prompt edited to save model, thinking low, timeout 900, active hours, failure alert after 3 with a 2 h cooldown) and Learn from conversations (a hand-edited run message plus model, thinking, timeout, lightContext, exact toolsAllow of 6 tools, idleOnly, pacing and a trigger), each on session:<key>; both first runs succeeded, then Conversations was paused. After the upgrade, the first load of the Scribes page:

  • paired both automations with their conversations and sent exactly one update turn to each conversation;
  • moved both to current; replaced Consolidation's unedited generated run message; left the hand-edited Conversations message byte-identical;
  • kept every saved option above, the pause, the owner, and the account-mode scheduled tool policy (field-for-field comparison).

Then on 02995e6: Run now on Consolidation ran in a fresh agent:main:cron:<job>:run:<id> session, called knowledge_status (owner store, writes enabled), and the page showed its status line with an Open run link read from run history. Repair on Conversations after archiving its conversation restored the conversation, turned the automation on and sent no turn.

3. Lost response on a real Gateway, both late retry paths. The page's chat.send frame was sent, then its WebSocket was closed before the answer (a lost response); on 02995e6 the conversation was also kept busy with a 90 s turn so the update stayed late; the page clock was advanced 3 minutes once the page showed "Updating…". Counted by update messages that reached the scribe conversation:

Path Build Identities sent Inputs accepted
Automatic update → Try again → response lost 457d4aa X, Y (lost), Z (new, sent by the reconnected page) 3: Y and Z duplicate one retry
Automatic update → Try again → response lost 02995e6 X, Y (lost), Y again 2: X and Y
Replace with new → Try again → response lost 02995e6 A, B (lost), B again 2: A and B

Out of scope

Follow-up

  • In one Replace run, the model re-declared the automation keeping an owner note from an earlier turn in the same conversation instead of writing the new run message exactly. The page correctly did not mark the replacement applied (it compares the saved message with the new one) and kept offering Try again. Making the replacement turn write the message exactly is a separate follow-up.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves scribe retry identities across failed sends and Gateway reconnects and adds incident citations to existing Granola instructions.

Example: Knowledge Consolidation stays unchanged for three minutes, then a Try again response is lost.

  • Before: Reconnecting and retrying creates another request identity and can start a duplicate update turn.
  • After: The reconnected page repeats the failed request identity, so the Gateway accepts one turn for that retry.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair supported by recorded Gateway results, relevant regression coverage, and passing current-head gates.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The body records the changed Scribes retry paths running through Chromium, real plugin hosts, isolated Gateways, and real model turns, with injected lost responses and accepted-input counts showing deduplication after reconnect.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Retrying a scribe update after a lost response can start another turn for the same attempt.
Reason: The focused repair preserves the approved update workflow, avoids duplicate model work, and introduces no option or public contract change.

Regression provenance

Regression provenance — verified: source commit 18c0598e10de by Josh Lehman; canonical PR #197391 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

This PR fixes a current retry defect with focused changes and recorded real-Gateway results; no actionable findings remain, and current-head CI passes.

Priority: P2
Reviewed head: 02995e6c49e79de73f6d5671e1f2831ba6715fa5

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Knowledge Scribes page reads automation and conversation state, sends update requests through the authenticated plugin host, and watches the scheduler for the resulting changes.

flowchart TD
  A[Scribes page] --> B[Gateway scoped retry state]
  B --> C[Current plugin host]
  C --> D[Gateway chat send]
  D --> E[Scribe conversation]
  E --> F[Scheduler automation]
  F --> A
Loading

Technical review

Best possible solution:

Keep the existing attempt map and replacement closure as owners, retaining each failed request identity across reconnects until its send succeeds.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes both identity-loss paths, and the supplied Gateway comparison records duplicate accepted inputs before the reconnect repair; this review executed no target code.

Is this the best way to solve the issue?

The change restores one request identity per failed send using existing owners, and its focused regressions cover the distinct automatic-update, replacement, and reconnect boundaries without unnecessary machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e711369ecfc3.

Provenance checked

  • Failed-send retry identity keeps the original intent (18c0598: The original update lifecycle distinguishes a fresh attempt after an unchanged completed turn from a transport retry of the same request.)
  • Attempt and pending-update lifetime changes intended behavior with a stated reason (18c0598: State was scoped to a Gateway host; the PR's real reconnect reproduction explains why host replacement loses the identity and why retry state must survive it.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 18c0598 adds extensions/knowledge/src/scribes-updates.ts:57 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 18c0598e10de; files: extensions/knowledge/src/scribes-updates.ts)

PR surface

Source +19, Tests +26, Docs +5. Total +50 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 43 24 +19
Tests 1 30 4 +26
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 78 28 +50

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Lost responses can duplicate Knowledge scribe update turns, with impact limited to this retry workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-13T01:54:27.224Z sha 457d4aa :: needs maintainer review before merge. :: none

Reviewed November 13, 2026, 12:04 AM ET / 05:04 UTC (Revision 2).

@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 13, 2026
@jalehman
jalehman merged commit 30ce1b5 into main Nov 13, 2026
122 of 124 checks passed
@jalehman
jalehman deleted the fix/knowledge-scribe-retry-identity branch November 13, 2026 05:15
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 14, 2026
…se (openclaw#198030)

* fix(knowledge): scribe retries repeat the request after a lost response

* fix(knowledge): keep scribe update attempts across Gateway reconnects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. plugin: knowledge proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant