LoopForge icon indicating copy to clipboard operation
LoopForge copied to clipboard

[Bug]: local/dsh-plugin — /loopforge and loopforge_status always throw "workingDirectory" without inject

Open TaylorChen opened this issue 2 weeks ago • 2 comments

Component / host

Local — DeepSeek Harness (local/dsh-plugin). The bug-report form has no option for this host yet — another item worth adding, see "Related observations".

Edition

Local Portable

LoopForge version

commit dd56585276d8ecb6e0d6865f55e255194d75f85a — local/dsh-plugin = @tencent/[email protected]

What happened?

The Host bundle installs and activates (application: applied, row @tencent/loopforge-dsh resolves), but both surfaces it registers fail on every call with:

Error: cannot get property "workingDirectory" without inject
  • the loopforge_status agent tool returns that error instead of {"found": false}
  • /loopforge ... goes through the same cwdOf(), so it fails the same way

So the plugin is unusable on DSH 0.2.2-rc.3, even on a project where the Portable skill is installed.

Reproduction

  1. Install the Portable skill into a project (see "Related observations" #1 for why npx -y loopforge-cli@latest cannot do this today):

    node <repo>/local/bin/loopforge.mjs skills install dsh --project-root <project>
    
  2. Install the bundle into a DSH profile:

    dsh plugin --profile <profile> add -w <repo>/local/dsh-plugin
    
  3. Restart DSH, then call the loopforge_status tool from the agent, or type /loopforge status.

  4. Observe Error: cannot get property "workingDirectory" without inject instead of a status result.

Cause

index.js reads workingDirectory as a context property:

const service = agent?.ctx?.workingDirectory
  ?? agent?.ctx?.get?.('workingDirectory')
  ?? owner?.ctx?.workingDirectory
  ?? owner?.ctx?.get?.('workingDirectory')

but declares only:

export const inject = ['commands', 'tools']

In Cordis, reading an un-injected service property throws rather than returning undefined, so the DSH_PROJECT_ROOT / process.cwd() fallbacks are never reached.

Separately, the Agent contract in DSH is { readonly id: SessionId }; workingDirectory.get(session) takes a Session, which the plugin does not have here. workingDirectory.ensure(agent) is the documented way to get a session's directory from an Agent.

Suggested fix

  1. Declare the service:

    export const inject = ['commands', 'tools', 'workingDirectory']
    
  2. Resolve the directory through the service API:

    async function cwdOf(ctx, owner) {
      const agent = owner?.agent ?? owner
      const service = ctx.workingDirectory
      if (agent && typeof service?.ensure === 'function') {
        try { return resolve(await service.ensure(agent)) } catch {}
      }
      return resolve(process.env.DSH_PROJECT_ROOT ?? service?.defaultDirectory ?? process.cwd())
    }
    
  3. await the two call sites — handle() and the tool's execute().

Verified with this patch on DSH 0.2.2-rc.3 (macOS arm64, Node 24.19.0, Python 3.13.3): the tool returns {"found": false} on a fresh project, and /loopforge start <request> creates artifacts/<slug>/workflow-state.json through the skill's scripts/workflow_state.py.

Diagnostics

DSH             0.2.2-rc.3 (desktop runtime), profile-managed
OS              macOS 15 arm64
node            v24.19.0
python3         3.13.3
bundle          @tencent/loopforge-dsh 0.1.0 (link: install from local dir)
error           Error: cannot get property "workingDirectory" without inject

Related

  • #112 / #120 — feature requests for a DSH host plugin, closed 2026-11-10. This bug is in the plugin that landed afterwards (local/dsh-plugin), so it is not a re-report of those.
  • Searched dsh and loopforge-dsh in existing issues: nothing covers this injection failure.

Related observations

  1. npm release lags the docs. npx -y loopforge-cli@latest skills install dsh fails with argument host: invalid choice: 'dsh' (choose from codebuddy, codex, cursor, claude) on [email protected] (published 2026-09-16), while docs/local/usage.md and local/dsh-plugin/README.md both document that exact command. local/src/devflow_cli/targets/dsh.py is already in the repo. Either cut a release or mark the DSH rows as "from source until the next release".
  2. Bundle assumes a project-local skill. SKILL_ROOT = '.dsh/skills/devflow' is hardcoded relative to the project, but DSH also scans the user root $DSH_HOME/skills. With the skill installed globally, /loopforge reports "Skill is not installed in this project". A project-first, $DSH_HOME/skills/devflow fallback would support both layouts. (The skill's Python also requires a sibling manifest.json in whatever skills root it lives in — DSH ignores that file, so it is safe to place there.)
  3. /devflow is not provided by this bundle. local/dsh-plugin/README.md lists /devflow <request> under "restart DSH and use", but the bundle registers only /loopforge; DSH surfaces skills through the skill tool/catalog rather than as slash commands. Splitting that list into "provided by this bundle" vs "provided by the skill install" would avoid the impression that both commands come from the plugin.
  4. Issue template. .github/ISSUE_TEMPLATE/bug_report.yml has no "Local — DeepSeek Harness" option under Component / host, although DSH is a documented supported host.

TaylorChen avatar Nov 16 '26 12:11 TaylorChen

Thanks for the detailed report! As I understand it, with the local/dsh-plugin bundle (@tencent/[email protected]) installed on DSH 0.2.2-rc.3, both the loopforge_status tool and the /loopforge command fail on every call with cannot get property "workingDirectory" without inject. You've also noted a few related items: the npm release lagging the docs for skills install dsh, the project-local skill path assumption, the /devflow README entry, and the missing DSH option in the bug-report template.

We've seen this and will look into it through the regular issue queue. The version, reproduction steps, diagnostics and suggested patch you provided are very helpful.

cocofhu00 avatar Nov 16 '26 13:11 cocofhu00

PR #1007 already covers the working-directory injection fix. I will address the separate documentation/template observations: distinguish the devflow Skill from commands registered by the optional DSH bundle, and add DeepSeek Harness to the bug-report host choices. No changes to the plugin execution paths.

wcy12378 avatar Nov 19 '26 10:11 wcy12378