Introduction

In DSH (DeepSeek Harness) development, when a model request fails and the upstream error code is not covered by the default policy, the request is often aborted directly. In particular, when a provider classifies an unrecognized upstream error as PI_AI_ERROR, the existing retry mechanism may not work. At this point, a fallback mechanism independent of the built-in policy is needed to handle this specific type of error.

What Is It

lim12137/dsh-llm-extra-retry is a DSH plugin designed to add an independent recovery policy to the model request failure waterfall. It is maintained by lim12137 and resolves the issue where automatic retry is unavailable when upstream returns the PI_AI_ERROR error code.

Core Features

This plugin provides the following capabilities:
* For PI_AI_ERROR errors, wait 20 seconds and then automatically retry once.
* Other error codes retain the default policy of @deepseek-ai/dsh-llm-retry (5 bounded exponential backoffs).
* Uses an independent policyKey for accounting, and does not interfere with built-in policies.

Installation and Enablement

Integrate the plugin into the DSH environment by following these steps:
1. Add this directory as a link: dependency in profiles/web/package.json;
2. Locate dsh.profile.bundles in the configuration and add "dsh-llm-extra-retry";
3. Ensure that node_modules/dsh-llm-extra-retry is a directory symlink pointing to this directory;
4. Restart DSH to apply the configuration.

Typical Usage

The default behavior of the plugin is: when PI_AI_ERROR is detected, wait 20 seconds and retry once. If you need to adjust the waiting duration or retry count, modify the lib/index.js file in the plugin root directory by changing the DELAY_MS or MAX_RETRIES constant at the top.

Use Cases and Notes

This plugin is suitable for scenarios that require fallback retry for specific error codes. Before use, check the source code and license (MIT). Note: request cancellation or unloading the plugin will immediately abort the pending backoff.

Conclusion

By introducing this plugin, an independent recovery policy for PI_AI_ERROR can be added to model request failures in DSH. For more details, refer to the GitHub repository.