Conversation
After a daemon restart that reloads the plugin, browser_* calls fail with
unknown tool "browser_session" until the model happens to invoke the skill
again, even though the session's durable history already proves it ran.
None of the three triggers covers that case. The live tools/result hook needs
a fresh invocation. session/created never fires for a session that already
exists. The boot scan runs once during apply(), and ctx.get("sessions") yields
nothing when the sessions service is registered after this plugin, so it covers
nothing at all.
session/event already receives the session and ignored it. Reading its history
when nothing else has revealed the suite closes the gap, and is guarded so the
scan stops once revealed — these events are frequent and re-deriving on each
one after the reveal is waste.
Keeps the reveal derived from durable history rather than adding a persisted
flag, so there is no new state to migrate or keep consistent.
Parse current durable tool results and support both session history APIs. Scan each session once, process later events incrementally, and retry recovery when services or history become available. Cover official DSH messages, reloads, long conversations, failed reads, and explicit history access counts.
Retain successful invocation proof after failures and defer retries to turn/session boundaries or new skill invocations. Add regression coverage for sustained streaming and next-turn recovery.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #269.
After
browser-skillhas been invoked successfully, reloading the plugin can leavebrowser_sessionunavailable. Startup discovery may miss existing sessions, and durable DSH tool results use a nested message shape that the previous history parser did not recognize.This restores the browser tool suite from successful invocation history, including sessions discovered after startup. It supports both current nested tool-result messages and the earlier flat result shape, plus the newer
snapshotEvents()API and the legacyeventsgetter. Failed calls and mismatched call IDs do not reveal tools.Each session's existing history is scanned once per plugin lifetime; subsequent events are processed incrementally. Pending calls are tracked separately by session and removed when they settle. History-read failures remain retryable. Failed registration retains the invocation proof and retries at the next turn, session entry, service discovery, or new successful skill invocation; ordinary streaming events keep folding without repeated registration attempts or warnings. Each session-discovery batch makes at most one registration attempt, and pending recovery skips session enumeration. The skill documents how to recover from an unknown browser tool after reload by invoking
browser-skillagain. Unload disposes listeners and state. The original contribution is retained, including its three regression cases; the post-reveal guard test now explicitly asserts the history getter was never called.Validation
pnpm lintpassed, including formatting, style checks, plugin type checking, and all 328 plugin tests.skilltool once, unloaded/reloaded the packaged plugin, then directly listed and started a browser session, read a local page snapshot, and stopped the session. The test uses deterministic model output with the real agent loop, message factories, session store, registry, plugin lifecycle, CLI, daemon, and Chromium extension. Exactly one skill invocation; no browser sessions left afterward.Streaming cost
Local macOS/Node 22 microbenchmark using real DSH 0.1.0-rc.6 Sessions. Three repetitions per case; values are median cumulative time for event appends plus listener processing, with no browser skill invocation:
The updated implementation handled 100,000 events in 331.24 ms with one history read. After reveal, it performed zero history reads for 20,000 further events. This removes the repeated full-history traversal and copying; an initial scan remains proportional to the existing history length. These timings are local measurements, not guarantees for every host.