Skip to content

fix(agent-runtime): keep unreplayable search history usable - #836

Merged
vastsa merged 1 commit into
mainfrom
fix/hosted-search-legacy-replay
Sep 22, 2026
Merged

vastsa merged 1 commit into
mainfrom
fix/hosted-search-legacy-replay

Conversation

@vastsa

@vastsa vastsa commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Problem

#825 made provider-hosted search replay validate strictly. A stored record whose
blocks cannot be normalised now fails the turn with a terminal local
context-validation error — but the persistence layer itself writes such blocks:
hostedSearchReplayBlocks keeps a block without blockId when a gateway drops
ids, and the transcript renders it with an anonymous round
(packages/shared/src/native-web-search.ts). The record stays readable, yet every
later turn of that conversation fails, and restarting or reopening the session
does not recover it.

Fix

  • A block that cannot be replayed degrades the whole stored replay for that message
    to "no replay" — the same state as a message stored before replay existed —
    instead of failing the turn. Keeping the paired half would leave an orphan block
    the adapter cannot accept.
  • A container that is not a block list still fails as a local context-validation
    error, so a corrupt record is not silently accepted.
  • The diagnostic records the block count and phases only; search content, results
    and credentials are never copied.

Tests

  • packages/agent-runtime/src/hosted-search-replay.test.ts: the two new cases fail
    on the merged fix(agent-runtime): repair hosted-search continuation contracts #825 code (LocalRequestError) and pass here. One of them builds its
    fixture through the real hostedSearchFromMessage persistence path.
  • scripts/e2e/hosted-search-scenarios.mjs: invalid-search-container keeps its
    rejection assertions (0 provider requests); invalid-search-phase now asserts the
    turn continues with 1 provider request and that the unreplayable block never
    reaches the provider.

Verification

  • pnpm test:e2e:hosted-search: 7/7 scenarios pass, including the rewritten pair.
  • pnpm build:js, Desktop typecheck, pnpm lint, architecture check,
    pnpm docs:check (505 pages), agent-runtime 58 files / 917 tests.
  • Specs updated in EN and ZH (03-runtime/08-error-codes.md,
    03-runtime/11-provider-model-system.md), plus docs/project/unreleased.md and
    the fix(agent-runtime): repair hosted-search continuation contracts #825 verification record.

Follow-up to #825.

A stored search record whose blocks cannot be replayed rejected every later
turn of that conversation with a terminal local context-validation error. The
persistence layer itself writes such blocks: when a gateway drops ids it keeps
a display-only block and the transcript renders it with an anonymous round, so
pre-upgrade histories were readable and then became unusable.

The message now degrades to "no replay" for that turn instead of failing it,
which is what a message stored without replay already meant. A container that
is not a block list stays a local validation error, and the diagnostic records
the block count and phases without copying search content or credentials.

Specs, the offline hosted-search E2E scenarios and the unreleased notes follow
the new boundary.
Copilot AI lite review requested due to automatic review settings September 22, 2026 02:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vastsa
vastsa merged commit 5c7e67a into main Sep 22, 2026
4 checks passed
@vastsa
vastsa deleted the fix/hosted-search-legacy-replay branch September 22, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants