Introduction¶
When having a long conversation in DeepSeek Harness (DSH), if you’re not satisfied with a turn’s answer, common workarounds are to copy the user’s question and send it again, or click “Branch” on the action bar to start a new conversation. The former still lets the model see its own previous answer, making it easy to revise along the old line of thought; the latter cuts off the subsequent context within the same conversation. If the goal is to stay in the current conversation and redo only a specific turn, you first need to remove that turn’s old answer from the message list sent to the model, then resubmit the turn’s user question.
Below we introduce the community plugin dsh-session-retry (maintainer linanbuan): it adds a “Re-answer” button to the action bar of each assistant message. It first registers a surface rewrite, then backfills the write when the next step’s request opens, so that when the model re-answers it cannot see its own previous output in that turn; historical messages in the UI and logs remain untouched. Categorized as Workflow; repository linanbuan/dsh-session-retry, current version 1.0.0, license MIT. The DSH community directory skillhub.cn is an independent site, with no official affiliation to DeepSeek / High-Flyer.
What Is This¶
dsh-session-retry is a standard DSH bundle: the host side registers the API and backfills the surface replacement inside the agent/request hook; the browser side registers the action-bar button with the conversation.chat.assistant-actions slot (row id: session-retry, order: 20, positioned between Copy and Branch). The browser side only depends on react and does not require any Harness client package; the host side injects connection and agents.
Core Features¶
What It Does in the UI¶
The action bar matches the native buttons: square icon, hover tooltip, shown/hidden along with that turn’s action bar. The client pulls an anchor table once per conversation; each action bar looks up the table by messageId — a hit enables the button, a miss grays it out with a reason.
On click, it first calls the rewrite API, and only on success resubmits the question with session.prompt([{ type: 'text', text }], 'queue') (the same path as conversation.send in ui-conversation). Only when both steps succeed does it show “Re-answered (the old answer has exited the context…)”; if the rewrite fails, it merely relays the reason and does not submit, avoiding re-asking while the old answer is still in the context.
Host API¶
Two routes are registered on the shared /api channel (read-only / rewrite):
POST /api/session-retry/context { sessionId }
→ { ok, sessionId, latestTurn, cached, anchors: [...] }
POST /api/session-retry/regenerate { sessionId, messageId }
→ { ok, turn, promptSeq, runs, shadowed, kept, eventSeqs, deferred: true }
/context scans the conversation log, pairing “which assistant message the action bar hangs on” with “that turn’s user question”, and caches the result per conversation for about 1.5 seconds. /regenerate only targets live sessions (in-memory sessions.get(id)), recomputes anchors on the fly using the same retryTargets rules as /context, and registers a shadow plan (deferred: true) — it does not write the surface at click time.
How the Old Answer “Disappears”¶
What is rewritten is the surface, not the log: conversation records, UI history, title and statistics are preserved; the list sent to the model is determined by dsh-session’s surface folding and deriveMessages().
The mechanism: when the next step opens, a system/message event carries surfaceOp: { op: 'replace', startSeq, endSeq } with the complete sourceEventSeqs, using an empty system node as a placeholder (an empty user message would actually be sent, so it is not used). Because V4 requires a step event’s turn/step to equal the currently open pair, writing on the spot while idle when the button is clicked would corrupt the log; therefore /regenerate only registers the plan and backfills the write in the agent/request hook using the turn/step that is open at that moment — surface nodes earlier than this turn’s question are kept, and this turn’s artifacts are shadowed and replaced in segments according to shadowPlan().
Determination Rules (Consistent with the UI)¶
The action bar hangs on the last assistant/message in the last text-producing step of each turn. If the turn has no text-producing step, the UI does not render the action bar at all. The turn’s question is taken from messages with source.kind === 'user' after turn/start and before the anchor; context injections, compaction checkpoints, and replacements carrying surfaceOp are not counted as questions. Multiple user messages within the same turn (steering / queued) are merged into one paragraph and resent, and the prompt will note “merged N questions”. Non-text blocks (images, attachments) are only counted, not resent.
Deliberate Trade-offs¶
| Behavior | Description |
|---|---|
| Shadow instead of delete | Log events cannot be deleted; to start a complete new history, use “Branch” |
| Re-answering an earlier turn | The shadow scope extends from that turn’s question to the end of the surface, so subsequent turns also exit the context |
| Live sessions only | Returns NOT_LIVE if not open; returns RUNNING if answering, stop first |
| Dependency degradation | /context is UNAVAILABLE if sessionQuery is missing; /regenerate likewise if sessions is missing |
Installation and Enablement¶
First install the DSH desktop app (deepseek.com/download). Choose any of the following installation methods; <spec> can be a repository URL, a GitHub source zip, an absolute path to a local directory, or a possible future npm package name.
Method 1 (recommended): In the sidebar, Plugins → Add Plugin, and enter, for example:
https://github.com/linanbuan/dsh-session-retry
After confirming the information, Install, then Enable now. No command line needed, no manual profile editing required.
Method 2: In a conversation, give the repository URL or local directory to the Agent, which calls plugin_manager (action: install_bundle).
Method 3: If the dsh CLI is installed:
dsh plugin --profile <profile name> add <spec>
See dsh plugin --help for parameters.
Method 4 (troubleshooting): Register dependencies and dsh.profile.bundles in package.json at ~/.dsh/profiles/<profile name>; under WSL, Linux symbolic links may not be resolvable by the Windows-side Electron, so it is better to install on the Windows side or use a copy of the directory.
After installation: changing client.js can be hot-mounted by disabling then enabling the plugin on the plugin page; the browser side updates via /plugins/events with no page refresh needed. Changing index.js or package.json requires restarting the app (the host’s ESM cache does not refresh on hot-mount). Node requirement: >=20; the development validation environment is DSH 0.1.7-rc.2 (Windows desktop).
Typical Usage¶
- Open a conversation in DSH and wait for a turn’s assistant answer to finish (the action bar appears on that turn’s last text-bearing assistant message).
- If you are not satisfied with that turn’s answer, click Re-answer on that assistant message’s action bar (located between Copy and Branch).
- If the conversation is generating, stop it first before clicking; on success, the request is re-queued with that turn’s user question (or the merged text of multiple messages), and the old answer no longer enters the model context.
- If you need to preserve a complete timeline “including the old answer” as evidence, switch to Branch to start a new conversation instead of treating the same conversation rewritten by this plugin as the sole chain of evidence.
The plugin makes no network calls and has no telemetry; it reads conversation logs and in-memory objects with the current DSH process’s permissions. Review the source code and the MIT license yourself before installing. It relies on internal contracts such as surfaces and step events, which are not stable APIs; after a Harness upgrade the button may gray out or the rewrite may fail, in which case the plugin only relays the reason and does not submit — by design it avoids corrupting the log. Before 0.3.0, it wrote step events on the spot while idle, causing log corruption; starting from 1.0.0 it uses deferred backfill writes; please upgrade from older versions. The official plugin manager currently does not support automatic updates; upgrading requires uninstalling and reinstalling, and restarting the app after host changes.
Development and Testing¶
Zero-dependency unit tests in the repository:
node test/retry-targets.mjs
node test/client-contract.mjs
Or npm test (equivalent to the two commands above).
Conclusion¶
dsh-session-retry breaks “redoing a specific turn within the same conversation” into two steps — a surface shadow rewrite plus resending the user question — and aligns with the UI rules for action-bar anchoring, merging multiple questions, and skipping non-text content. It suits scenarios where you want to quickly iterate on a single turn’s answer in a DSH workflow without branching and losing subsequent context.
- Community directory: https://www.skillhub.cn/plugins/linanbuan/dsh-session-retry
- GitHub: https://github.com/linanbuan/dsh-session-retry