Introduction¶
In the DeepSeek Harness (DSH) workflow, forking a session is a common operation. When the source session is running or has queued messages, forking directly causes the child session to inherit the pending prompts from the source session. As a result, the child session prioritizes executing the leftover commands from the source session, while the new prompt you just sent is deferred to the next turn. This not only causes duplicate execution of instructions but also disrupts the expected conversational flow.
dsh-fork-inbox-guard is a Host plugin that ensures the first interaction in the child session directly responds to the currently sent prompt by clearing the pending message queue inherited after forking.
Core Features¶
- Discard inherited messages: When creating a child session, remove pending prompts inherited from the source session.
- Prioritize new prompts: Ensure that the first turn in the child session answers the message you are currently sending.
- Logging: Mark discarded messages as
outcome: canceledand preserve theagent/inbox/splicedevent record. - Entry override: Intercept the Fork session entry in the sidebar and the Branch entry in the message menu to prevent accidental inheritance of stale queues.
Installation and Enablement¶
Run the following command from the plugin directory to install it:
dsh plugin --profile web add "link:$(pwd)"
After installation is complete, restart the dsh web service. To uninstall it, run:
dsh plugin --profile web remove dsh-fork-inbox-guard
This plugin only modifies Host-side logic and does not register Client modules, so a frontend rebuild is not required.
Typical Usage¶
Once the plugin is active, you can verify its behavior through the child session logs. In the logs of the forked session, find the agent/inbox/spliced event. Its outcome field should be canceled, and removedCount should be 1. This record corresponds to the discarded inherited message, while the subsequent user/message event is your newly sent prompt.
The plugin itself outputs a log message indicating that it dropped a pending Inbox associated with a seeded session:
fork-inbox-guard: dropped the pending inbox of seeded session "session-xxxx"
The default web profile does not include the console logging plugin, so this message will not appear in the terminal. To view it in the terminal, you need to mount @deepseek-ai/cordis-plugin-logger-console.
Applicable Scenarios and Notes¶
- Scope of effect: It only applies to newly created child sessions and does not retroactively fix existing historical sessions.
- Fork algorithm: It does not modify the fork cut-point algorithm inside Harness. Therefore, in the child session logs, the source session’s insert events still appear first, followed by the canceled splice event.
- API dependency: It relies on the public Harness API (stability is not guaranteed in versions before 1.0). After upgrading DSH, it is recommended to rerun
just test. - Conflict handling: If upstream logic directly clears the child session’s inbox during forking, this plugin detects the empty queue and skips the operation, so no conflict occurs.
- Resume and no seed:
resumeoperations are unaffected; for new sessions without a new seed, the plugin does not intervene.
Short Conclusion¶
By clearing inherited queues, this plugin resolves instruction misalignment and duplicate execution issues in fork operations. It is suitable for scenarios that require fine-grained control over session inheritance behavior.