In agent development, CI failures often require interrupting the current task to check logs in a browser or terminal. Context switching adds cognitive overhead. The dsh-onfail plugin exposes failure states directly in the DSH Web interface, allowing you to fix issues without leaving the current session.

Plugin Overview

This is a networked tool plugin for DeepSeek Harness (DSH), maintained by ZZZjf13960. Using a polling mechanism, it retrieves the Actions run status of the current workspace’s GitHub repository (the current branch or the HEAD of an open PR) and displays new failed checks as sidebar cards. After clicking a card, the plugin reads the log context and calls the current session’s session.prompt interface to continue handling the error in the current task.

Core Features

  1. Poll GitHub Actions failure status
    The plugin does not rely on Webhooks. Instead, it checks the repository’s Actions run records through scheduled polling (default interval 60 seconds). It filters failed Jobs for the current branch or PR HEAD and records displayed Job IDs to avoid duplicate stacking.

  2. Sidebar card display
    Failed checks appear as cards at the bottom of the DSH Web sidebar or in an overlay. The card content includes the Job name, commit SHA, and a truncated log snippet (default truncation: 4000 characters).

  3. Click to continue the current session
    Clicking a card does not create a new session or interrupt the current task. It calls the current session’s session.prompt(..., 'queue') method to push the failed Job’s context (repository, Job ID, SHA, and logs) into the current queue, enabling seamless remediation.

  4. Fixture mode
    Supports use in environments without a Token or in testing environments. Enable it through configuration or set the environment variable DSH_ONFAIL_FIXTURE=1, and the plugin loads the built-in fixtures/failed-run.json data for demonstration.

Installation and Activation

Installing this plugin requires a configured DSH Web Profile first.

1、Run the following command to install the plugin:

dsh plugin --profile web add github:ZZZjf13960/dsh-onfail

2、Start or restart the DSH Web UI:

dsh --profile web

3、In the plugin settings card, the Onfail (GitHub Actions) option should be visible. A CI control will appear at the bottom of the sidebar, and failed checks are rendered as cards.

Configuration and Usage

Basic Configuration

The following parameters can be configured in the plugin settings card or in cordis.patch.yml:

Configuration Default Description
repo Auto Automatically retrieved from git remote get-url origin, or manually specified as owner/name. Leave empty to use automatic detection.
token Empty GitHub Token. Preferentially obtained via gh auth login.
pollIntervalMs 60000 Polling interval, in milliseconds.
logTailChars 4000 Number of characters to keep from the log tail.
fixture false Whether to enable Fixture mode.

Token Permissions and Resolution

The plugin requires permission to read GitHub Actions. The Token resolution priority is as follows:

  1. The token field in plugin configuration
  2. gh auth token (if the gh command is available)
  3. Environment variable DSH_ONFAIL_TOKEN
  4. Environment variable GITHUB_TOKEN

For fine-grained Personal Access Tokens (PAT), the Actions: Read permission must be granted.

Fixture Mode Testing

In testing or Token-less environments, Fixture mode can be enabled in the following ways:

  • Check Fixture mode in the settings card
  • Set the environment variable DSH_ONFAIL_FIXTURE=1
  • Set config.fixture: true in the loader configuration

When enabled, the plugin loads fixtures/failed-run.json data to simulate failed card rendering.

Use Cases and Notes

Use Cases:
* You need to fix CI errors “in place” and do not want to switch between the browser and DSH.
* Centrally manage development and debugging workflows within the DSH Web interface.

Notes:
* The plugin must run within an existing DSH Web Profile environment.
* Clicking a card to continue a session requires that an active session currently exists. If there is no active session, the card displays a role=status error message instead of a success status.
* The plugin itself does not crash. If the Token is missing and the gh command is unavailable, the plugin displays a readable error message without causing the Harness to crash.