dsh-workflow-model-guard: Extending Sub-Agent Model Allowlists to Cover Workflows

Preface

DeepSeek Harness (DSH) has two paths for dispatching subagents: the subagent tool and the agent() function within the workflow tool. The official “allowed models” allowlist only applies to the former. When the latter is given an invalid route, it does not raise an error but instead silently returns null, causing upstream callers to mistakenly believe execution succeeded. This blind spot leads to a large number of subagent failures that are difficult to diagnose.

dsh-workflow-model-guard is a DSH plugin that extends the subagent model-selection allowlist to the workflow path. The plugin adopts a zero-configuration design—defaults are ready to use out of the box. Through a two-tier mechanism consisting of a soft layer (system prompt guidance) and a hard layer (tools/pre-execute hook), it prompts the model to check before selecting a route, and intercepts unauthorized routes on the spot with corrective suggestions.

Plugin Overview

  • Name: dsh-workflow-model-guard
  • Maintainer: Rayzenchen
  • Category: admin-security
  • Core value: Unifies the two “parent agent dispatches subagent” paths so that the model-selection policy is enforced once, eliminating silent failures.

Two-Tier Mechanism

The plugin leverages existing official extension points and introduces no additional dependencies.

Soft Layer: Prompt Guidance

The plugin injects a guidance block into the system prompt via ctx.systemPrompt.section. It is only active when the agent can see the workflow tool and list_subagent_models is available. The text lists the routes allowed in the current session and advises the model to call list_subagent_models before specifying a provider/model. If uncertain, it should leave the fields empty to inherit the parent route. If the tools are not visible, the section renders as empty and is discarded, adding no prompt overhead.

Hard Layer: tools/pre-execute Interception

The plugin hooks into ctx.on('tools/pre-execute', (exec, next) => …) to intercept workflow tool execution. It performs a static lexical scan of the script, reading provider/model values from object literals. If a value is not in the current session’s allowlist, it returns {kind:'deny', reason}. The reason message names the offending route (with line number), lists the allowed routes, and provides two corrective suggestions.

Installation & Activation

Install from GitHub:

github:Rayzenchen/dsh-workflow-model-guard

Paste the above spec into DSH’s “Settings → Plugins” page. The plugin is loaded on the host side at startup and takes effect without a restart. For local development mode, you can add the plugin directory as link:/absolute/path to the profile’s dsh.profile.bundles and dependencies, run pnpm install in the profile directory, then restart DSH.

Configuration

The plugin provides configurable defaults in cordis.patch.yml. Changes require replacing the entire config object (no deep merge).

Key Default Description
enabled true Master switch; when false, neither layer is attached
toolName workflow The tool name to govern
discoveryToolName list_subagent_models Discovery tool name, used for guidance injection
injectGuidance true Soft layer toggle
enforceRoutes true Hard layer toggle
unresolvedRoute allow Policy when a static route cannot be determined: allow / deny / ask
denyWhenPolicyUnreadable false Whether to deny when the allowlist is completely unreadable

Limitations & Boundaries

The hard layer uses heuristics and does not guarantee completeness. The plugin performs only a static lexical scan and does not evaluate scripts, so the following cases may go undetermined:

  • Only one of provider or model is provided, and the other side matches an allowed route—the effective route depends on the inherited half;
  • The value is a variable, template string, conditional expression, or passed in from outside the script;
  • The script constructs the agent call via string concatenation.

In these cases the default is unresolvedRoute: allow (only block what can be proven). If a stricter policy is needed, set it to deny or ask, at the cost of potentially blocking legitimate scripts.

The hard layer only intercepts routes explicitly written by the model. Calls that inherit the parent route (i.e., omitting provider/model) are always allowed through.

Verification

Quick Check

Run in the plugin directory:

node tools/self-test.mjs

Real-Session Acceptance

  1. Soft layer: Start a new session. When the workflow tool is visible, the system prompt should contain a section titled Workflow subagent model selection… (listing the allowed routes for the current session). When the tool is not visible, the section should be absent.
  2. Hard layer rejection: In a workflow script, call agent(p, { provider: 'X', model: 'Y' }). If X/Y is not in the allowlist, the call is denied, and the reason names the invalid route and provides two corrective options.

Use Cases

Ideal for developers who need to enforce a unified model-selection policy across DSH workflows and want to avoid silent failures. The plugin runs with the permissions of the current DSH process; review the source code and license before installing.

Conclusion

dsh-workflow-model-guard unifies the subagent model allowlist across both dispatch paths: it guides the model to check before selecting a route via prompt, and provides clear corrective suggestions when an unauthorized route is attempted. Without taking over the workflow engine, it delivers a practical and configurable guardrail.

  • Catalog page: https://www.skillhub.cn/plugins/Rayzenchen/dsh-workflow-model-guard
  • GitHub: https://github.com/Rayzenchen/dsh-workflow-model-guard
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye