dsh-taskbridge 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +755 -751
- package/antigravity/skills/dsh-taskbridge/SKILL.md +1 -0
- package/codex/skills/dsh-taskbridge/SKILL.md +69 -23
- package/codex/skills/dsh-taskbridge/{rules-reference-96027c387cb9b7587efa4aa3836235d86db1108068e007dc08196e807ca25e5d.md → rules-reference-7e1f2f22aaf0e95cb9acb0aad9a9750732ba4f669ae0155925e8fcf25e9594bf.md} +73 -11
- package/docs/INTRODUCTION.md +153 -148
- package/docs/INTRODUCTION.zh.md +156 -151
- package/docs/antigravity-integration.md +47 -47
- package/docs/assets/taskbridge-workflow.en.svg +72 -72
- package/docs/claude-code.md +18 -18
- package/docs/codex-integration.md +1102 -1102
- package/docs/releases/1.8.0.zh.md +16 -16
- package/docs/releases/1.8.1.zh.md +24 -24
- package/docs/releases/1.9.0.zh.md +31 -31
- package/docs/releases/1.9.1.zh.md +14 -0
- package/docs/releases/1.9.2.zh.md +21 -0
- package/docs/runtime-compatibility.md +4 -4
- package/docs/taskbridge-upgrade.md +1 -1
- package/lib/client.js +3 -3
- package/locale/en.json +7 -7
- package/locale/zh.json +7 -7
- package/package.json +158 -156
- package/src/antigravity/installer.js +1101 -1099
- package/src/antigravity/seam.js +142 -142
- package/src/client/api.js +4 -4
- package/src/client/index.jsx +3 -3
- package/src/codex/installer.js +4621 -4610
- package/src/jobs/record-cleanup.js +715 -715
|
@@ -1,1102 +1,1102 @@
|
|
|
1
|
-
# Codex integration contract
|
|
2
|
-
|
|
3
|
-
Status: implemented in 1.9.
|
|
4
|
-
|
|
5
|
-
The 1.7.0 release also makes future managed upgrades self-recognising: the two exact
|
|
6
|
-
companions this machine really held (`1.6.1` in both terminator spellings and the local
|
|
7
|
-
`1.6.1-test.5` prerelease) are now enumerated, and an explicit install or the startup refresh
|
|
8
|
-
records the LF-normalized digest of the template it wrote, in one small file per real Codex
|
|
9
|
-
home. A LATER release therefore recognises the template the previous one wrote without
|
|
10
|
-
appending another digest by hand, while an edited file — one changed character, or only the
|
|
11
|
-
`version` line — still stays the operator's and is never rewritten. See section 5.
|
|
12
|
-
|
|
13
|
-
1.5.1 refreshes the manifest on each activation, resolves a normal linked home root, and upgrades exact shipped/candidate templates while preserving custom content. See [1.5.1 notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.5.1.zh.md).
|
|
14
|
-
|
|
15
|
-
1.5.0 adds `delegate_question_answer`, combined decision/answer-and-wait flows and program metrics. Managed upgrades recognize the exact published 1.4.2 and verified local test.1/test.2 companions; customized files remain operator-owned. See the [1.5.0 release notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.5.0.zh.md).
|
|
16
|
-
|
|
17
|
-
1.4.2 also recognizes the exact published 1.4.1 companion for managed upgrades.
|
|
18
|
-
The review behavior introduced in 1.4.1 recognizes the exact unmodified
|
|
19
|
-
1.4.0 companion in LF and CRLF forms, and updates the review contract: a completed
|
|
20
|
-
task may be read and reviewed by its original identity after a restart. History
|
|
21
|
-
does not restore execution or old permissions. Reviews are confirmed only when
|
|
22
|
-
`reviewPersistence.durable` is true (`state: "saved"`); `saving` or `timed-out`
|
|
23
|
-
means the write is still unconfirmed, and `failed` permits a retry. Ordinary waits
|
|
24
|
-
omit review prose. A result that reports `noteOmitted: true` can be read with
|
|
25
|
-
`delegate_result` plus `reviewNoteOffset` and optional `reviewNoteLimit` (1–2000
|
|
26
|
-
Unicode code points per page, default 2000); follow `nextOffset` until `complete`.
|
|
27
|
-
Review notes accept up to 8000 code points after trimming and are stored redacted.
|
|
28
|
-
See the [release notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.4.1.zh.md) for validation boundaries.
|
|
29
|
-
|
|
30
|
-
This document is the contract between the plugin's settings page (browser half),
|
|
31
|
-
the host-side installer (`src/codex/installer.js`) and the skill files and MCP entry it manages.
|
|
32
|
-
It is written so a reviewer can check the code against it without reading the
|
|
33
|
-
README.
|
|
34
|
-
|
|
35
|
-
## Native Codex Skill migration (1.9.0)
|
|
36
|
-
|
|
37
|
-
Starting in `1.9.0`, the managed Codex target is the native skill
|
|
38
|
-
`$CODEX_HOME/skills/dsh-taskbridge/SKILL.md` (with independent ownership digests in
|
|
39
|
-
`codex-skill-ownership`). Installing a native skill instead of a subagent allows the active
|
|
40
|
-
Codex session to read the workflow directly and drive one `delegate_submit` +
|
|
41
|
-
`delegate_wait` chain (using `tool_timeout_sec = 3660`) instead of wrapping dispatch in
|
|
42
|
-
`spawn_agent` + short-timeout `wait_agent` polling loops.
|
|
43
|
-
|
|
44
|
-
The generated entry carries the ordinary flow and links a same-directory rules reference for
|
|
45
|
-
multi-stage planning and uncommon events. Installation publishes the reference before switching
|
|
46
|
-
`SKILL.md`. Older references remain available to Codex sessions that already loaded a previous
|
|
47
|
-
entry. Startup restores a missing reference for an unchanged entry. An edited reference makes
|
|
48
|
-
both files operator-managed. Uninstall removes the unchanged active pair after proving ownership.
|
|
49
|
-
|
|
50
|
-
An explicit `install`, startup refresh, or `remove` inspects `$CODEX_HOME/agents/dsh-taskbridge.toml`
|
|
51
|
-
and `$CODEX_HOME/agents/dsh-delegate.toml` against both `KNOWN_AGENT_TEMPLATES` (`0.1.6`–`1.8.x`)
|
|
52
|
-
and historical `codex-agent-ownership` records. Untouched legacy managed subagent files are
|
|
53
|
-
unlinked ONLY after re-proving their exact bytes (and, on install/refresh, after confirming
|
|
54
|
-
`skills/dsh-taskbridge/SKILL.md` is ready). Any user-modified legacy file is preserved untouched
|
|
55
|
-
and surfaced via `LEGACY_AGENT_USER_MODIFIED`. Boundary checks cover `$CODEX_HOME`, `skills/`,
|
|
56
|
-
`skills/dsh-taskbridge/`, and `agents/`.
|
|
57
|
-
|
|
58
|
-
The action result's `changed` array reports `agent` for a write or removal of
|
|
59
|
-
`SKILL.md`, `legacyAgent` for removal of one or more managed legacy TOML files,
|
|
60
|
-
and `mcp` for a change to the MCP entry. An install that writes the skill and
|
|
61
|
-
retires a legacy file includes both `agent` and `legacyAgent`.
|
|
62
|
-
|
|
63
|
-
## TaskBridge companion migration (1.3.2)
|
|
64
|
-
|
|
65
|
-
The public companion is now `dsh-taskbridge`, installed as
|
|
66
|
-
`agents/dsh-taskbridge.toml`. An explicit install or the startup refresh migrates
|
|
67
|
-
an unchanged, recognized published `agents/dsh-delegate.toml` and removes the old
|
|
68
|
-
managed file after the new managed template is present. Edited files and an
|
|
69
|
-
operator-owned destination remain untouched; startup does not perform a first
|
|
70
|
-
installation when no previous managed companion exists. The MCP table remains
|
|
71
|
-
`mcp_servers.dsh-delegate`, and `delegate_*` tool names remain compatible.
|
|
72
|
-
|
|
73
|
-
1.4.0 recognizes the exact published 1.3.2 companion and refreshes its waiting rules
|
|
74
|
-
on plugin startup. After examining a delivered result, the companion records its own
|
|
75
|
-
accepted or changes-requested conclusion with `delegate_review`; the plugin never
|
|
76
|
-
derives acceptance from completion. A client may need reloading to see the refreshed
|
|
77
|
-
agent and tool catalog. Edited companion files remain operator-owned.
|
|
78
|
-
|
|
79
|
-
Explicit install/repair can also adopt a marked standard legacy MCP path after
|
|
80
|
-
the old `dsh-delegate` or `dsh-taskdispatch` package has been uninstalled from the
|
|
81
|
-
same `node_modules` as the current `dsh-taskbridge`. This narrow exception does
|
|
82
|
-
not apply to custom wrappers, other directories, or automatic startup refresh.
|
|
83
|
-
`repair` remains MCP-only. TaskBridge CLI aliases point at the existing bin files.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Explicit task descriptions (1.5.4)
|
|
88
|
-
|
|
89
|
-
`delegate_submit` and `POST /tasks` accept optional `goalDescription`; `delegate_review` and `POST /tasks/review` accept optional `completionSummary`. Both trim surrounding whitespace, preserve internal newlines, and allow at most 2000 Unicode code points before and after redaction. Missing or blank strings are absent; explicit null and other non-strings are refused. No value is inferred from prompts or earlier tasks.
|
|
90
|
-
|
|
91
|
-
The goal is fixed at task creation. The completion summary exists only under `hostAcceptance.completionSummary`, is part of the review identity with decision and note, and becomes public only after the same review write is durable. A saved review cannot gain or change a summary. Compact waits return only its character count and an omission flag; full results contain the prose. History retains titles and explicit continuation references without inventing missing old data.
|
|
92
|
-
|
|
93
|
-
## 1. What is owned, and what is not
|
|
94
|
-
|
|
95
|
-
| Path | Owner | The plugin may | The plugin may never |
|
|
96
|
-
| --- | --- | --- | --- |
|
|
97
|
-
| `$CODEX_HOME/skills/dsh-taskbridge/SKILL.md` | managed copy of `codex/skills/dsh-taskbridge/SKILL.md` | create it **exclusively** on explicit install (or legacy migration) when absent; refresh a byte-exact known build during plugin startup or explicit install; delete it on `remove` only after re-reading it and finding the same bytes it classified (and unlink untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml` after re-proving their bytes) | overwrite or delete a file that is not that exact build — including a skill or legacy agent file whose body was edited, and including a file that changed in the window between the status read and the write/removal |
|
|
98
|
-
| `$CODEX_HOME/config.toml`, table `mcp_servers.dsh-delegate` | operator, with one managed entry | add the entry when absent; update `command`/`args`/its own `env.DSH_DELEGATE_DISCOVERY_FILE` when the entry carries **the plugin marker** *and* is the exact shape this plugin writes; on an explicit `install`/`repair` only, adopt a recorded `args[0]` that is a PROVED real installation of this package (manifest `name` + `bin["dsh-delegate-mcp"]` mapping) | touch any other key, table, comment or ordering; adopt, update or delete an unmarked same-name entry, even one whose values coincide; adopt a differing script path from the automatic startup check |
|
|
99
|
-
| `$CODEX_HOME`, `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge` and `$CODEX_HOME/agents` | Codex | resolve and pin a normal root symlink/junction to its real directory; inspect all 4 boundary levels in one batched Windows check; create missing `skills/dsh-taskbridge` (`0700`) on explicit install | retarget or delete the root alias; follow a link in `skills/`, `skills/dsh-taskbridge/`, `agents/` or the final file; write through an unusable or unverified target |
|
|
100
|
-
| DSH local-call switch | operator | report it | change it |
|
|
101
|
-
|
|
102
|
-
`$CODEX_HOME` resolution: `CODEX_HOME` when set and absolute; otherwise
|
|
103
|
-
`~/.codex`. A relative override is refused (`CODEX_HOME_INVALID`), because
|
|
104
|
-
resolving it against the harness's cwd would report on, and write to, a directory
|
|
105
|
-
nobody named.
|
|
106
|
-
|
|
107
|
-
### 1.1 Link boundaries
|
|
108
|
-
|
|
109
|
-
`lstat` on the final file is not enough: if `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge`, or `$CODEX_HOME/agents` is a junction,
|
|
110
|
-
`mkdir -p` and the file create would walk *through* it and write outside the Codex home entirely. Since 1.5.1 the selected HOME root is first pinned to its real directory; since 1.9.0 that real root plus `skills/`, `skills/dsh-taskbridge/` and `agents/` are inspected together as boundaries:
|
|
111
|
-
|
|
112
|
-
| `$CODEX_HOME` | `skills/` · `skills/dsh-taskbridge/` · `agents/` | result |
|
|
113
|
-
| --- | --- | --- |
|
|
114
|
-
| real directory | missing | normal: explicit `install` creates `skills/dsh-taskbridge` (`0700`) |
|
|
115
|
-
| real directory | real directory | normal |
|
|
116
|
-
| real directory | link (symlink or junction) | `agent.state = conflict`, `reason = skills-dir-is-link` / `skill-dir-is-link` / `agents-dir-is-link`; install/repair/remove all refuse with `AGENT_PATH_CONFLICT` |
|
|
117
|
-
| root symlink/junction with a real directory target | checked under the pinned real target | normal root alias; alias preserved, subdirectory/file links still refused |
|
|
118
|
-
| could not be verified | — | `agent.state = conflict`, `reason = boundary-unverified`; same refusal |
|
|
119
|
-
|
|
120
|
-
A **junction** is the case `lstat` cannot see: Windows reports it as an ordinary
|
|
121
|
-
directory. On Windows the `ReparsePoint` file attribute is read through one
|
|
122
|
-
`powershell.exe` child (`-NoProfile -NonInteractive`, hidden, 15 s bound), with the
|
|
123
|
-
paths passed in an environment variable rather than interpolated into script text.
|
|
124
|
-
The child answers one comma-separated verdict per path — `dir/<bool>`, `other/<bool>`
|
|
125
|
-
or `missing` — and the boolean is PowerShell's `Boolean.ToString()` output, whose
|
|
126
|
-
spelling is **not** stable (`True`/`False` on Windows PowerShell 5.1, `true`/`false`
|
|
127
|
-
under other hosts/cultures). The verdict is therefore parsed case-insensitively
|
|
128
|
-
(`parseDirectoryVerdict`), the script emits lower case via `ToLowerInvariant()`, and
|
|
129
|
-
anything that is not a recognised `dir/`/`other/`/`missing` answer is treated as
|
|
130
|
-
`other` (a path this plugin will not write under), never as a missing answer.
|
|
131
|
-
A regular directory — `dir/false` in any spelling — is `directory`, so the ordinary
|
|
132
|
-
Windows layout is unaffected; only `dir/true` / `other/true` are reported as a link.
|
|
133
|
-
This is pinned by a real-directory probe test that runs the actual PowerShell child on
|
|
134
|
-
a temporary directory on Windows (and skips elsewhere), not only through the test
|
|
135
|
-
classifier hook.
|
|
136
|
-
|
|
137
|
-
The status document reports this as `boundary: { blocked, link, unknown, home,
|
|
138
|
-
skills, skillDir, agents }`. A **failed** verification is a refusal, not a pass: if the platform
|
|
139
|
-
answer cannot be obtained (no spawnable shell, no PowerShell), the boundary is
|
|
140
|
-
`unknown` and every action refuses, because "could not check" must never be read
|
|
141
|
-
as "safe". The check is re-done at the start of every writing action from the
|
|
142
|
-
freshly read status, so a link that replaced either directory after the operator
|
|
143
|
-
last looked is still refused.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## 2. The MCP entry
|
|
149
|
-
|
|
150
|
-
The owned shape, written as a marked block:
|
|
151
|
-
|
|
152
|
-
```toml
|
|
153
|
-
# dsh-delegate: managed by the DSH Delegate plugin settings page
|
|
154
|
-
[mcp_servers.dsh-delegate]
|
|
155
|
-
command = "<a Node.js executable, resolved as described in 2.1>"
|
|
156
|
-
args = ["<installed package>/bin/dsh-delegate-mcp.js"]
|
|
157
|
-
tool_timeout_sec = 3660
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
* `command` is an **absolute path to a Node.js executable**, never a bare `node` and
|
|
161
|
-
never the desktop application. A GUI-launched Codex often has a narrower `PATH`
|
|
162
|
-
than the shell that started DSH, so a bare `node` fails at spawn time; and in the
|
|
163
|
-
DSH Desktop (Electron) host `process.execPath` is `DeepSeek Harness.exe`, which
|
|
164
|
-
would make Codex launch a second GUI instead of an MCP server. Section 2.1 states
|
|
165
|
-
how the executable is chosen and what happens when no candidate can be proved.
|
|
166
|
-
* `args[0]` is derived from `import.meta.url` of the running module, so it names
|
|
167
|
-
the *installed* package — never a repository checkout and never a path captured
|
|
168
|
-
when the tarball was built.
|
|
169
|
-
* `tool_timeout_sec = 3660` (1.1.0) is an **owned scalar on this entry only**. The
|
|
170
|
-
`delegate_wait` tool defaults to a 3600-second wait and caps it there, so a client that
|
|
171
|
-
honours this field is allowed to let one call run that long. The plugin cannot prove that
|
|
172
|
-
every client honours it: a client that applies its own tool timeout may still end the
|
|
173
|
-
wait earlier. That is an OUTER limit and is not a `wait-limit` answer. The managed entry
|
|
174
|
-
therefore *requests* 3660 s — the 3600-second wait plus one minute of slack, never a
|
|
175
|
-
second wait window — while a client-side cap that ignores the field remains a client
|
|
176
|
-
limit the plugin cannot lift. This is not a Codex-wide setting and the plugin writes it
|
|
177
|
-
nowhere else.
|
|
178
|
-
* When a client exposes a yield/pragmas parameter, an ordinary wait should request
|
|
179
|
-
roughly `1200000` ms (20 minutes), not one minute. A one-minute return is a caller
|
|
180
|
-
choice, not a documented hard maximum, and not every client supports the same long
|
|
181
|
-
yield — the agent is told to state what its client actually offers rather than
|
|
182
|
-
describe one minute as inherent.
|
|
183
|
-
* A managed entry written by an earlier release has no such field. It is classified
|
|
184
|
-
`outdated` and repaired **in place** (the line is inserted inside our table), so an
|
|
185
|
-
existing installation updates through the settings page instead of being reported as
|
|
186
|
-
somebody else's file.
|
|
187
|
-
* A managed entry with a different integer is likewise `outdated` and rewritten to
|
|
188
|
-
3660. A non-integer value is not a value this plugin writes, so the whole entry is
|
|
189
|
-
treated as operator-owned and left untouched (`timeout-not-an-integer`).
|
|
190
|
-
* An unmarked same-name entry stays a conflict regardless of its values: the marker
|
|
191
|
-
comment is the only authorship proof this format carries.
|
|
192
|
-
* `env.DSH_DELEGATE_DISCOVERY_FILE` is written only when DSH uses a non-default
|
|
193
|
-
discovery location (`DSH_HOME` set, or `DSH_DELEGATE_DISCOVERY_FILE` set). The
|
|
194
|
-
default stays implicit so a later `DSH_HOME` change is not silently overridden.
|
|
195
|
-
|
|
196
|
-
### 2.1 The `command` executable (`resolveNodeExecutable`)
|
|
197
|
-
|
|
198
|
-
The host is classified first (`hostRuntimeKind`): `process.versions.electron` makes
|
|
199
|
-
it an **electron** host; `process.resourcesPath` (set by Electron and by nothing in
|
|
200
|
-
plain Node.js) is an equivalent desktop signal; otherwise it is a **node** host.
|
|
201
|
-
|
|
202
|
-
| host | `process.execPath` | selected `command` |
|
|
203
|
-
| --- | --- | --- |
|
|
204
|
-
| plain Node.js | `node`/`node.exe` | that path, unchanged — it is the runtime that loaded this plugin |
|
|
205
|
-
| plain Node.js, `execPath` is not a Node binary | an embedded host binary | falls through to the desktop rules below, never `execPath` |
|
|
206
|
-
| DSH Desktop (Electron) | `DeepSeek Harness.exe` | the DSH **bundled runtime**, below |
|
|
207
|
-
|
|
208
|
-
The bundled runtime is
|
|
209
|
-
`<resources>/runtime/primary-runtime/dependencies/node/bin/node.exe` on Windows and
|
|
210
|
-
`…/bin/node` elsewhere (`packagedNodePath`). `<resources>` is `process.resourcesPath`
|
|
211
|
-
when the host exposes it; otherwise it is derived from the application executable as
|
|
212
|
-
`<dirname(execPath)>/resources` — the layout DSH Desktop installs into
|
|
213
|
-
(`…\DeepSeek Harness\resources\…` beside `…\DeepSeek Harness\DeepSeek Harness.exe`).
|
|
214
|
-
|
|
215
|
-
If the bundled runtime is not there, these environment variables are consulted **in
|
|
216
|
-
this order**, and the first usable one wins:
|
|
217
|
-
|
|
218
|
-
| variable | accepted when |
|
|
219
|
-
| --- | --- |
|
|
220
|
-
| `DSH_NODE_PATH` | an absolute path |
|
|
221
|
-
| `DSH_NODE_EXECUTABLE` | an absolute path |
|
|
222
|
-
| `CODEX_MCP_NODE_PATH` | an absolute path |
|
|
223
|
-
|
|
224
|
-
"Usable" is strict: the value must be **absolute**, its basename must be a Node
|
|
225
|
-
binary (`node`, `node.exe`, or a versioned `node-*.exe`), and `lstat` must report an
|
|
226
|
-
existing **regular file**. A relative path, a directory, a link and a missing file
|
|
227
|
-
are each rejected with a reason, and their rejection does not stop the next
|
|
228
|
-
candidate from being tried.
|
|
229
|
-
|
|
230
|
-
**Fail closed.** When no candidate is usable, `resolveNodeExecutable` throws
|
|
231
|
-
`CodexInstallError('MCP_EXECUTABLE_UNRESOLVED')`. The desktop application executable
|
|
232
|
-
and a bare `node` are never substituted. The status document reports this instead of
|
|
233
|
-
throwing: `mcp.node = null`, `mcp.nodeResolved = false`, `mcp.nodeError = { code,
|
|
234
|
-
message, details }`, `mcp.state = unreadable` (`reason: no-executable`), `ready =
|
|
235
|
-
false`, plus an `MCP_EXECUTABLE_UNRESOLVED` note. `install` and `repair` refuse the
|
|
236
|
-
MCP target with `MCP_EXECUTABLE_UNRESOLVED` and leave `config.toml` byte-identical;
|
|
237
|
-
the agent file is an independent target and is still installed.
|
|
238
|
-
|
|
239
|
-
### 2.1 Classification
|
|
240
|
-
|
|
241
|
-
`classifyMcpEntry` locates the definition (block or inline), then decides:
|
|
242
|
-
|
|
243
|
-
| state | meaning | install |
|
|
244
|
-
| --- | --- | --- |
|
|
245
|
-
| `not-configured` | no `mcp_servers.dsh-delegate` at all | writes the block |
|
|
246
|
-
| `configured` | the marker is present **and** the values are exactly the owned shape | no change |
|
|
247
|
-
| `outdated` | marked owned command, but stale `args`/discovery/`tool_timeout_sec`; or the narrowly recognised 0.1.6 Desktop command with the current package `args` and owned env shape | rewrites only those values in place |
|
|
248
|
-
| `conflict` | anything else (`unmanaged-entry`, `unmanaged-entry-exact`, `command-not-ours`, `legacy-command-shape`, `url`, `unknown-field`, `extra-env`, `args-not-an-array`, `command-not-a-string`, `not-a-table`, `array-table`, and the boundary reasons below) | **refuses** with `MCP_ENTRY_CONFLICT` and a note explaining why; `repair` adds the marker for `unmanaged-entry-exact` only |
|
|
249
|
-
|
|
250
|
-
Every classification also reports **`drift`**: the list of owned facts that are stale
|
|
251
|
-
(`tool_timeout_sec`, `args`, `command`, `env`), or `null` when nothing is. The status
|
|
252
|
-
document publishes it as `mcp.drift`, and the note for an `outdated` entry names each
|
|
253
|
-
one, so neither the page nor a log line has to infer what a repair would change.
|
|
254
|
-
|
|
255
|
-
An `args[0]` that names `dsh-delegate-mcp.js` somewhere ELSE is a `conflict`
|
|
256
|
-
(`args-shape-not-ours`) in a bare status read: the synchronous classifier cannot prove that
|
|
257
|
-
a different path is this package, so it never labels one `outdated`. Only an explicit
|
|
258
|
-
`install`/`repair` may adopt it, after the asynchronous proof below — and only with the
|
|
259
|
-
config digest, the `$CODEX_HOME`/`skills`/`skills/dsh-taskbridge`/`agents` boundary and the current entry re-checked
|
|
260
|
-
immediately before the write. A different script name, a different command or an extra
|
|
261
|
-
argument stays `conflict` everywhere.
|
|
262
|
-
|
|
263
|
-
When `$CODEX_HOME`, `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge` or `$CODEX_HOME/agents` is a link (or cannot be verified), the MCP
|
|
264
|
-
target is reported as `conflict` with `reason` `codex-home-is-link`, `skills-dir-is-link`, `skill-dir-is-link`,
|
|
265
|
-
`agents-dir-is-link` or `boundary-unverified` — the same verdict the skill target gets.
|
|
266
|
-
The entry is **not** read through the link, because a link bounds every write this
|
|
267
|
-
module makes, not only the skill file.
|
|
268
|
-
|
|
269
|
-
Two rules are deliberate:
|
|
270
|
-
|
|
271
|
-
* **`unmanaged-entry`.** Values alone never establish ownership. An entry without
|
|
272
|
-
the marker comment — even one whose `command`/`args` are byte-identical to what
|
|
273
|
-
the plugin would write — is the operator's. It is reported as a conflict, and
|
|
274
|
-
`install`, `repair` and `remove` all leave it byte-identical. The marker must be
|
|
275
|
-
the comment line directly above the definition (or above the `[mcp_servers]`
|
|
276
|
-
header when the definition is the inline `dsh-delegate = { … }` spelling); a
|
|
277
|
-
marker elsewhere in the file does not count.
|
|
278
|
-
* **`unmanaged-entry-exact`.** The same unmarked definition, but it already IS this
|
|
279
|
-
build's entry in every owned fact: `command` is the resolved Node executable, `args` is
|
|
280
|
-
exactly this installation's entry script, `tool_timeout_sec` is the owned integer, and
|
|
281
|
-
the `env` map is exactly the owned one (no additional key, none missing) — and the
|
|
282
|
-
definition is ONE unambiguous standard `[mcp_servers.dsh-delegate]` table with unique
|
|
283
|
-
keys. This is the configuration the settings page shows, entered by hand without the marker
|
|
284
|
-
comment. It stays a `conflict` for `status`, plugin startup and `remove`, but the reason
|
|
285
|
-
names it so that “仅修复 MCP 配置” (`repair`) may make ONE edit: insert the marker line
|
|
286
|
-
directly above the server's OWN header and change no other byte.
|
|
287
|
-
The write re-reads `config.toml`, requires the plan's digest, the boundary verdict, the
|
|
288
|
-
whole owned shape and this installation's exact script to still hold, and splices the
|
|
289
|
-
marker into the original text at the header line's character offset — so a BOM, mixed
|
|
290
|
-
CRLF/LF endings, an indented header, an operator comment above it and a missing final
|
|
291
|
-
newline all survive, and deleting the new line restores the file byte for byte. It then
|
|
292
|
-
verifies the marker is adjacent to the server's own header (never to a shared
|
|
293
|
-
`[mcp_servers]` parent, which would claim sibling entries), that the result classifies as
|
|
294
|
-
`configured`, and that the change is exactly that one line.
|
|
295
|
-
Refused, with the plain `unmanaged-entry` reason and a byte-identical file: any owned value
|
|
296
|
-
that differs; a duplicated key (the parser keeps every entry, so a merge would let the last
|
|
297
|
-
value win); an inline table beside or instead of the header; an extra or empty sub-table
|
|
298
|
-
such as `[mcp_servers.dsh-delegate.custom]`; a nested inline table value; an array table.
|
|
299
|
-
`install` never adds the marker.
|
|
300
|
-
* **`command-not-ours`.** A different command is a different program, so even
|
|
301
|
-
identical arguments do not make the entry ours. `extra-env` is symmetrical — an
|
|
302
|
-
`env` key the plugin did not write is the operator's data, and an entry carrying
|
|
303
|
-
one is reported as a conflict rather than pruned.
|
|
304
|
-
|
|
305
|
-
* **0.1.6 Desktop migration.** Version 0.1.6 could write the DSH Desktop GUI as
|
|
306
|
-
`command`. A marked entry is eligible for one automatic migration only when its
|
|
307
|
-
command has a path whose case-insensitive basename is exactly `DeepSeek Harness.exe`,
|
|
308
|
-
its `args` already name this installed package's `bin/dsh-delegate-mcp.js`, and its
|
|
309
|
-
env keys and values exactly match the currently owned shape. The installer then
|
|
310
|
-
reports `outdated` and replaces only the command with the proven Node runtime.
|
|
311
|
-
A bare GUI name, a similarly named executable, stale args, extra env or any other
|
|
312
|
-
command remains `conflict` and is left byte-identical.
|
|
313
|
-
|
|
314
|
-
### 2.2 Merge mechanics
|
|
315
|
-
|
|
316
|
-
`src/codex/toml.js` locates structure by line and column ranges and edits only
|
|
317
|
-
those ranges. It is a locator, not a validating TOML implementation, and it
|
|
318
|
-
refuses (`TomlSyntaxError`, carrying a line number) rather than guess:
|
|
319
|
-
|
|
320
|
-
* an unterminated single-line string, array or inline table;
|
|
321
|
-
* a table header with trailing text;
|
|
322
|
-
* a raw control character (0x00–0x08, 0x0A–0x1F except tab) **anywhere other than
|
|
323
|
-
as a line ending** — see below;
|
|
324
|
-
* text after a table header, an unbalanced bracket, a key without `=`.
|
|
325
|
-
|
|
326
|
-
**CRLF.** A Codex config touched by a Windows editor is normally CRLF. The locator
|
|
327
|
-
splits on `\n` only, treats a *terminal* `\r` as the second byte of a line ending
|
|
328
|
-
(it is skipped wherever whitespace would end a token), and every mutation re-joins
|
|
329
|
-
with the document's detected ending. Installing, updating and removing an entry in
|
|
330
|
-
a CRLF file therefore preserves CRLF and leaves every unrelated byte — comments,
|
|
331
|
-
settings, table order — exactly as it was. A `\r` **inside** a line (a broken or
|
|
332
|
-
mixed-ending file) is still a control character and still refuses the document as
|
|
333
|
-
a whole.
|
|
334
|
-
|
|
335
|
-
A refusal makes the whole action refuse (`CODEX_CONFIG_UNSUPPORTED`) and leaves
|
|
336
|
-
the file byte-identical. Nothing is ever written with a parsed-then-serialized
|
|
337
|
-
round trip, so comments and ordering cannot be lost.
|
|
338
|
-
|
|
339
|
-
Writes land through `writeFileAtomic` (temp file + rename), so a crash leaves the
|
|
340
|
-
previous or the new full document, never a partial one. A *first* agent file is
|
|
341
|
-
created with `link`, which fails when the target exists: a file that appears
|
|
342
|
-
between the status read and the write is reported (`AGENT_PATH_CONFLICT`,
|
|
343
|
-
`created-concurrently`) instead of being replaced.
|
|
344
|
-
|
|
345
|
-
### 2.3 Removal
|
|
346
|
-
|
|
347
|
-
`remove` deletes the `mcp_servers.dsh-delegate` table (header, assignments, child
|
|
348
|
-
tables and the plugin marker line) and the agent file when — and only when — that
|
|
349
|
-
file is the managed template or a byte-exact known prior build. Comments the
|
|
350
|
-
operator wrote *above* the marker stay; the marker itself is the plugin's line.
|
|
351
|
-
A `conflict` or `modified` target is reported and left untouched, including an
|
|
352
|
-
unmarked same-name entry. Removing twice is a no-op.
|
|
353
|
-
|
|
354
|
-
**The agent file is re-proved immediately before it is unlinked.** The status read
|
|
355
|
-
is stale by the time a removal runs: the operator, an editor or another tool may
|
|
356
|
-
have rewritten the file after the verdict. Deleting on the strength of that verdict
|
|
357
|
-
would destroy the new content, so `removeManagedAgentFile` reads the file again and
|
|
358
|
-
requires all of:
|
|
359
|
-
|
|
360
|
-
* it is still a **regular file** (not a link, not a directory) — otherwise
|
|
361
|
-
`AGENT_PATH_CONFLICT` (`reason: not-a-regular-file`);
|
|
362
|
-
* it still exists — otherwise `AGENT_PATH_CONFLICT`
|
|
363
|
-
(`reason: missing-before-removal`), reported as "no change", never as a deletion;
|
|
364
|
-
* its bytes are **exactly** the content the status derived its verdict from
|
|
365
|
-
(`agent.expect`) — otherwise `AGENT_USER_MODIFIED`
|
|
366
|
-
(`reason: modified-before-removal`) and the file is kept.
|
|
367
|
-
|
|
368
|
-
Only then is `unlink` called. A file that *looks* managed but differs by one
|
|
369
|
-
character is therefore refused, and an unlink the filesystem refuses (`EPERM`,
|
|
370
|
-
`EACCES`, `EBUSY`) is reported as `AGENT_PATH_CONFLICT` (`reason: unlink-refused`)
|
|
371
|
-
rather than thrown at the operator.
|
|
372
|
-
|
|
373
|
-
### 2.4 The startup upgrade of an installed integration (1.2.0)
|
|
374
|
-
|
|
375
|
-
`refreshKnownAgentTemplate({ refreshMcp: true })` — reached through the seam as
|
|
376
|
-
`refreshManagedIntegration({ startupTarget, backupDir })` and called once by plugin
|
|
377
|
-
activation — checks the managed skill, legacy subagents and the MCP entry:
|
|
378
|
-
|
|
379
|
-
| target | condition | write |
|
|
380
|
-
| --- | --- | --- |
|
|
381
|
-
| Codex skill | `outdated` (known template or matching ownership record) | replaced with this build's template |
|
|
382
|
-
| Legacy subagents | a `managed-legacy` file still matches the bytes read during inspection | installs the skill if absent, then retires the legacy file once the current or user-edited skill is present |
|
|
383
|
-
| MCP entry | `outdated` **and** passing the write gate below | the owned values rewritten in place, in ONE atomic write |
|
|
384
|
-
|
|
385
|
-
The automatic check only ever accepts THIS installation's exact entry point. The
|
|
386
|
-
moved-install case (a recorded `args[0]` that is a different, provable installation of the
|
|
387
|
-
same package) is described below but is performed only by an explicit `install`/`repair`;
|
|
388
|
-
startup leaves it byte-identical and reports `conflict`.
|
|
389
|
-
|
|
390
|
-
#### The write gate (`isOwnedStaleEntry`)
|
|
391
|
-
|
|
392
|
-
"The classifier said `outdated`" is not permission to write. An automatic, unreviewed
|
|
393
|
-
write additionally requires that the entry is provably this plugin's in EVERY owned fact:
|
|
394
|
-
|
|
395
|
-
| fact | required |
|
|
396
|
-
| --- | --- |
|
|
397
|
-
| marker comment | present (authorship proof) |
|
|
398
|
-
| `command` | exactly this package's Node command (or the narrowed 0.1.6 Desktop command) |
|
|
399
|
-
| `args` length | exactly 1 — no wrapper flags, no extra arguments |
|
|
400
|
-
| `args[0]` | **provably** this package's entry point (see below) |
|
|
401
|
-
| `env` keys | none that this plugin did not write |
|
|
402
|
-
|
|
403
|
-
**`args[0]` must be PROVED, not pattern-matched** (`isOwnedEntryScript`, asynchronous
|
|
404
|
-
because the proof is a filesystem one). There are exactly two accepted proofs:
|
|
405
|
-
|
|
406
|
-
1. **This installation's own file** — an absolute path that is the same location as this
|
|
407
|
-
package's `bin/dsh-delegate-mcp.js`, compared under the PLATFORM's case rules
|
|
408
|
-
(`samePlatformPath`). Linux compares exactly: two case variants are different programs
|
|
409
|
-
there. Windows is case-insensitive; macOS is treated the same way because its default
|
|
410
|
-
volumes are, which is an assumption rather than a promise on a case-sensitive volume. A
|
|
411
|
-
RELATIVE path is never equivalent: `relative/bin/dsh-delegate-mcp.js` names no location.
|
|
412
|
-
2. **A different, real installation of this package** — an absolute path ending in
|
|
413
|
-
`<root>/bin/dsh-delegate-mcp.js` with ALL of:
|
|
414
|
-
* `<root>` and `<root>/bin` are real directories and not links (a junction is caught by
|
|
415
|
-
the same attribute read the boundary check uses);
|
|
416
|
-
* `<root>/bin/dsh-delegate-mcp.js` is a regular, non-link file that IS the candidate
|
|
417
|
-
(compared by `realpath`, so a link cannot smuggle in another program);
|
|
418
|
-
* `<root>/package.json` is a regular, non-link file that declares one of this project's
|
|
419
|
-
own package names (`"dsh-taskbridge"`, `"dsh-taskdispatch"`, or `"dsh-delegate"`),
|
|
420
|
-
carries this project's GitHub repository provenance (`https://github.com/ranranyya/{dsh-taskbridge,dsh-taskdispatch,dsh-delegate}`),
|
|
421
|
-
AND maps `bin["dsh-delegate-mcp"]` to that very entry. A
|
|
422
|
-
`./` prefix is allowed; an absolute path, a `..` segment, a trailing slash, a wrong
|
|
423
|
-
mapping, a missing mapping, a foreign repository or no `bin` object is refused.
|
|
424
|
-
|
|
425
|
-
The `<root>` is derived with the host's `dirname`/`basename` rules (`packageEntryRoot`), so
|
|
426
|
-
a POSIX leading `/` is preserved: splitting on `/` and rejoining would turn
|
|
427
|
-
`/opt/pkg/bin/dsh-delegate-mcp.js` into the relative `opt/pkg/...`, and no real Linux or
|
|
428
|
-
macOS installation could ever be proved.
|
|
429
|
-
|
|
430
|
-
Everything else — a wrapper that reuses the marker, the command or even the file name; a
|
|
431
|
-
same-layout script whose manifest maps its bin elsewhere; a missing path; a link; a
|
|
432
|
-
directory that declares another package — is **not** claimed. The synchronous classifier is
|
|
433
|
-
even stricter: only proof 1 can make an entry `outdated`, so a differing script is always a
|
|
434
|
-
`conflict` (`args-shape-not-ours`) and a bare status read can never authorize a write. Proof
|
|
435
|
-
2 is attempted **only by an explicit `install`/`repair`**, never by the unattended startup
|
|
436
|
-
check, and it is re-run immediately before the write together with the plan's config digest
|
|
437
|
-
and the boundary re-check; an edit in that window is refused (`config-changed`).
|
|
438
|
-
|
|
439
|
-
An unprovable path is therefore KEPT and reported, with a note pointing at the explicit
|
|
440
|
-
button: this is the intended outcome, not a gap. The core upgrade — an exact `args` match
|
|
441
|
-
with only `tool_timeout_sec` missing — always succeeds automatically.
|
|
442
|
-
|
|
443
|
-
#### No concurrent change (`config-changed`)
|
|
444
|
-
|
|
445
|
-
The plan records a SHA-256 of the WHOLE `config.toml` (`mcp.fingerprint`, stripped from the
|
|
446
|
-
public status by `publicCodexStatus`). Immediately before the write the file is re-read and
|
|
447
|
-
the digest must match. Re-classifying alone is not enough: an operator can change an owned
|
|
448
|
-
value and leave an entry that still looks stale and managed, which is exactly the overwrite
|
|
449
|
-
this refuses. The result is `MCP_ENTRY_CONFLICT` with `reason: config-changed` and the file
|
|
450
|
-
is kept byte-identical. This is covered by a deterministic test that changes the file
|
|
451
|
-
between the plan and the write.
|
|
452
|
-
|
|
453
|
-
#### The backup is a PRECONDITION (`MCP_ENTRY_BACKUP_UNAVAILABLE` / `_FAILED`)
|
|
454
|
-
|
|
455
|
-
Before any automatic MCP write the current document is copied to a protected location, and
|
|
456
|
-
that copy is **verified**. It is not best-effort:
|
|
457
|
-
|
|
458
|
-
* no destination supplied → `MCP_ENTRY_BACKUP_UNAVAILABLE`, nothing written; a RELATIVE
|
|
459
|
-
destination is refused as well, because it would be resolved against the harness cwd;
|
|
460
|
-
* EVERY ancestor of the destination is proved to be a real directory — a symbolic link, a
|
|
461
|
-
Windows junction/reparse point, a component the platform cannot verify, or a file in the
|
|
462
|
-
chain refuses the whole backup, so a complete `config.toml` is never written through a
|
|
463
|
-
linked parent (a leaf-only check is not enough: `/safe/backup` can be a plain directory
|
|
464
|
-
below a junction);
|
|
465
|
-
* missing levels are created ONE at a time and each is inspected immediately afterwards; a
|
|
466
|
-
recursive `mkdir` would follow a link that appeared at any depth in the window;
|
|
467
|
-
* the chain is re-checked immediately before the copy is written, then the copy is written
|
|
468
|
-
atomically with owner-only permissions and RE-READ; a mismatch or a write failure →
|
|
469
|
-
`MCP_ENTRY_BACKUP_FAILED`, nothing written;
|
|
470
|
-
* an existing destination that is a link, a non-file, or holds different bytes is refused
|
|
471
|
-
rather than overwritten.
|
|
472
|
-
|
|
473
|
-
The seam supplies `<plugin dataDir>/codex-config-backup` by default, so a caller that passes
|
|
474
|
-
no location still gets one; a direct `refreshMcp` call with no trusted location refuses
|
|
475
|
-
instead of writing. The original file is always left exactly as it was on any refusal.
|
|
476
|
-
|
|
477
|
-
#### The rest of the guarantees
|
|
478
|
-
|
|
479
|
-
* an absent entry stays absent — the plugin never creates `config.toml` or the table at
|
|
480
|
-
startup, so an upgrade can never turn a non-installation into an installation, and the
|
|
481
|
-
same is true of `skills/` when neither the skill nor a recognized legacy companion is present;
|
|
482
|
-
* an unmarked entry, an operator-edited shape and any `conflict` are refused and left
|
|
483
|
-
byte-identical (the outcome carries `MCP_ENTRY_CONFLICT` with the reason);
|
|
484
|
-
* a link or unverifiable directory at `$CODEX_HOME` / `skills` / `skills/dsh-taskbridge` / `agents` is re-inspected immediately
|
|
485
|
-
before the write and produces ONE `AGENT_PATH_CONFLICT` refusal for the whole check, even
|
|
486
|
-
when the visible state shows nothing stale: an upgrade that cannot be proved safe must not
|
|
487
|
-
look successful;
|
|
488
|
-
* the pre-write document is copied to `backupDir` (the plugin data directory) first — never
|
|
489
|
-
into the package, never into the Codex home, and never returned in a response;
|
|
490
|
-
* nothing else in `config.toml` is touched: comments, ordering, other MCP tables, CRLF
|
|
491
|
-
line endings and every unrelated setting survive byte for byte.
|
|
492
|
-
|
|
493
|
-
#### Which home is targeted — ONE precedence for every seam call
|
|
494
|
-
|
|
495
|
-
`resolveHomePreference` is the single implementation, and `status()`, the explicit actions
|
|
496
|
-
and the automatic check all use it. Before that, the check consulted the recorded directory
|
|
497
|
-
while `status()` and the buttons consulted only `CODEX_HOME`/default, so removing
|
|
498
|
-
`CODEX_HOME` made the page report — and the buttons write — a different tree than the one
|
|
499
|
-
startup had just upgraded. The order is:
|
|
500
|
-
|
|
501
|
-
| precedence | target |
|
|
502
|
-
| --- | --- |
|
|
503
|
-
| 1 | an explicit `CODEX_HOME` (or the seam's explicit `codexHome`) |
|
|
504
|
-
| 2 | the home a SUCCESSFUL explicit install recorded in `<dataDir>/codex-installation.json` |
|
|
505
|
-
| 3 | the default (`~/.codex`), only when it exists and is a real directory |
|
|
506
|
-
|
|
507
|
-
A successful `install` records the directory even when it wrote nothing because the
|
|
508
|
-
installation was already exactly right: `changed: []` is a success, not "nothing happened".
|
|
509
|
-
A REFUSED install records nothing, so a refusal cannot become the remembered target.
|
|
510
|
-
|
|
511
|
-
In 1.5.1 the selected home root is pinned by the installer to its real target after this precedence resolution. A normal root symlink/junction is supported; an unresolvable or unverifiable target is refused. A missing home remains `no-codex-home`; a null startup target does not silently fall back to another tree. The root alias is preserved, and links below it in agents or the final files remain forbidden.
|
|
512
|
-
|
|
513
|
-
The explicit 「安装 / 更新 TaskBridge 技能」 button (action `install`) remains
|
|
514
|
-
the way to *create* the managed native skill (`skills/dsh-taskbridge/SKILL.md`) and MCP entry (and safely retire untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml`). `status` reports the drift (`mcp.drift`)
|
|
515
|
-
and, when an entry is `outdated`, a note naming exactly which owned facts are stale.
|
|
516
|
-
|
|
517
|
-
---
|
|
518
|
-
|
|
519
|
-
## 3. Actions and their guarantees
|
|
520
|
-
|
|
521
|
-
Reachable only through the authenticated user plane (section 4) or the CLI
|
|
522
|
-
`bin/dsh-delegate-codex-agent.js`.
|
|
523
|
-
|
|
524
|
-
| action | writes | never writes |
|
|
525
|
-
| --- | --- | --- |
|
|
526
|
-
| `status` | nothing | anything |
|
|
527
|
-
| `install` | native skill `skills/dsh-taskbridge/SKILL.md` (absent / older managed build) + retires untouched legacy `.toml` subagents + MCP entry (absent / `outdated`) | a user-modified skill or legacy agent file, a conflicting MCP entry, the DSH switch |
|
|
528
|
-
| `repair` | the MCP entry only (absent / `outdated`), exactly as `install` would; plus the marker line for an `unmanaged-entry-exact` definition | the skill or legacy agent files: they are **not created, not refreshed and not deleted**, nor is `skills/` or `agents/` created; no owned value of an unmarked entry is ever rewritten |
|
|
529
|
-
| `remove` | deletes only owned skill, untouched legacy `.toml` files and owned MCP entry | a user-modified skill or legacy agent file, a conflicting entry |
|
|
530
|
-
|
|
531
|
-
`install` is idempotent: a second run with nothing changed reports
|
|
532
|
-
`changed: []` and does not rewrite either file.
|
|
533
|
-
|
|
534
|
-
`install` reports the agent and MCP targets independently. One may succeed while
|
|
535
|
-
the other is refused (for example: no agent file yet, but a conflicting entry), and
|
|
536
|
-
the response says exactly which. The same holds for an unresolvable executable:
|
|
537
|
-
the agent file is still installed, and the MCP half is refused with
|
|
538
|
-
`MCP_EXECUTABLE_UNRESOLVED` (section 2.1).
|
|
539
|
-
|
|
540
|
-
**`repair` is MCP-only.** It is the action behind the settings page's
|
|
541
|
-
「仅修复 MCP 配置」 button and is the same code path `install` uses for its MCP half.
|
|
542
|
-
It never touches the agent file, so with a missing agent it reports
|
|
543
|
-
`agent.state = not-installed` and changes nothing, with an `outdated` agent it leaves
|
|
544
|
-
that file byte-identical (it stays `outdated`), and with a `modified`/`conflict` agent
|
|
545
|
-
it does not even report an agent refusal — the agent is simply out of this action's
|
|
546
|
-
scope. Concretely, `repair`:
|
|
547
|
-
|
|
548
|
-
* returns `changed` containing `mcp` (or nothing) and never `agent`;
|
|
549
|
-
* does not create `$CODEX_HOME/agents` when it is missing;
|
|
550
|
-
* still refuses a `conflict` MCP entry with `MCP_ENTRY_CONFLICT`, exactly like `install`.
|
|
551
|
-
|
|
552
|
-
Updating a stale agent is an explicit `install`, or the byte-exact startup refresh
|
|
553
|
-
described below.
|
|
554
|
-
|
|
555
|
-
**No action runs when the settings page opens, and package install writes nothing.**
|
|
556
|
-
The page's `init()` issues a `GET`; the three buttons are the only callers of the
|
|
557
|
-
`POST`.
|
|
558
|
-
|
|
559
|
-
**The single write at plugin load is the integration refresh.** `apply()` calls the
|
|
560
|
-
seam's `refreshManagedIntegration()` once — only when a Codex home directory exists — which
|
|
561
|
-
refreshes `skills/dsh-taskbridge/SKILL.md` when its complete bytes match a known prior build or recorded digest (and migrates/retires untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml` matching `KNOWN_AGENT_TEMPLATES` or `codex-agent-ownership`), **and** upgrades an already installed
|
|
562
|
-
`mcp_servers.dsh-delegate` entry that is provably this plugin's and merely stale
|
|
563
|
-
(section 2.4). It never performs a first-time install when neither the skill nor a recognized legacy companion is present, never creates
|
|
564
|
-
the MCP entry, and never touches a `modified`/`conflict` file: everything else stays an
|
|
565
|
-
explicit `install`. A refusal or failure is logged and startup continues, so a Codex
|
|
566
|
-
problem cannot stop the plugin from loading.
|
|
567
|
-
|
|
568
|
-
---
|
|
569
|
-
|
|
570
|
-
## 4. Routes
|
|
571
|
-
|
|
572
|
-
One exact path, two methods, registered on `ctx.connection.fetch` (the
|
|
573
|
-
authenticated operator channel):
|
|
574
|
-
|
|
575
|
-
| method | path | body | result |
|
|
576
|
-
| --- | --- | --- | --- |
|
|
577
|
-
| `GET` | `/api/dsh-delegate/codex` | — | `{ ok, action: 'status', changed: [], refused: [], codex, switch }` |
|
|
578
|
-
| `POST` | `/api/dsh-delegate/codex` | `{ "action": "install" \| "repair" \| "remove" }` | `{ ok, action, changed, refused, codex, switch }` |
|
|
579
|
-
|
|
580
|
-
Refusals use the standard envelope and these codes: `CODEX_ACTION_INVALID` (400),
|
|
581
|
-
`CODEX_HOME_INVALID` (400), `CODEX_CONFIG_UNSUPPORTED` (409),
|
|
582
|
-
`CODEX_CONFIG_UNREADABLE` (409), `CODEX_INTEGRATION_UNAVAILABLE` (503). A refusal
|
|
583
|
-
*per target* is not an HTTP error: it appears in `refused[]` with a stable `code`
|
|
584
|
-
(`AGENT_USER_MODIFIED`, `AGENT_PATH_CONFLICT`, `MCP_ENTRY_CONFLICT`,
|
|
585
|
-
`MCP_SCRIPT_MISSING`, `CODEX_CONFIG_UNSUPPORTED`) and the action still answers 200
|
|
586
|
-
with the fresh status, because "I did not touch your file, and here is why" is a
|
|
587
|
-
successful diagnosis.
|
|
588
|
-
|
|
589
|
-
`codex` (status document):
|
|
590
|
-
|
|
591
|
-
```jsonc
|
|
592
|
-
{
|
|
593
|
-
"codexHome": "…",
|
|
594
|
-
"packageVersion": "1.9.
|
|
595
|
-
"boundary": {
|
|
596
|
-
"blocked": false, "link": null, "unknown": false,
|
|
597
|
-
"home": "directory", "skills": "directory", "skillDir": "directory", "agents": "directory"
|
|
598
|
-
},
|
|
599
|
-
"skill": {
|
|
600
|
-
"path": "…/skills/dsh-taskbridge/SKILL.md", "state": "installed", "installed": true, "managed": true,
|
|
601
|
-
"reason": null, "expect": "<the exact bytes a refresh may replace>"
|
|
602
|
-
},
|
|
603
|
-
"agent": {
|
|
604
|
-
"path": "…/skills/dsh-taskbridge/SKILL.md", "state": "installed", "installed": true, "managed": true,
|
|
605
|
-
"reason": null, "expect": "<compatibility alias of skill>"
|
|
606
|
-
},
|
|
607
|
-
"legacyAgents": { "state": "absent", "entries": [] },
|
|
608
|
-
"mcp": {
|
|
609
|
-
"path": "…", "exists": true, "serverName": "dsh-delegate",
|
|
610
|
-
"state": "configured", "configured": true,
|
|
611
|
-
"previous": { "command": "…", "args": ["…"], "envKeys": [] },
|
|
612
|
-
"reason": null,
|
|
613
|
-
"marked": true,
|
|
614
|
-
"desired": { "command": "…", "args": ["…"], "env": {} },
|
|
615
|
-
"node": "…", "nodeResolved": true, "nodeError": null,
|
|
616
|
-
"script": "…", "scriptExists": true,
|
|
617
|
-
"discoveryFile": "…", "discoveryPinned": false
|
|
618
|
-
},
|
|
619
|
-
"config": { "readable": true, "error": null },
|
|
620
|
-
"ready": true,
|
|
621
|
-
"notes": [{ "code": "…", "text": "…" }]
|
|
622
|
-
}
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
Agent states: `not-installed`, `installed`, `outdated`, `modified`, `conflict`.
|
|
626
|
-
MCP states: `not-configured`, `configured`, `outdated`, `conflict`, `unreadable`.
|
|
627
|
-
`unreadable` covers both "the config cannot be read safely" and — as of 0.1.7 —
|
|
628
|
-
"no Node.js executable could be proved" (`reason: no-executable`), in which case
|
|
629
|
-
`desired` is `null`, `node` is `null`, `nodeResolved` is `false` and `nodeError`
|
|
630
|
-
carries the `MCP_EXECUTABLE_UNRESOLVED` diagnosis (section 2.1).
|
|
631
|
-
Boundary kinds: `directory`, `missing`, `link`, `other`, `unchecked` (for the level
|
|
632
|
-
below a link, which is deliberately not inspected), and `unknown` when the platform
|
|
633
|
-
answer could not be obtained.
|
|
634
|
-
|
|
635
|
-
`boundary.blocked` is true when any checked boundary directory is a link or could not be verified;
|
|
636
|
-
`boundary.link` names the level (`codex-home`, `skills`, `skillDir` or `agents`) and is `null` otherwise.
|
|
637
|
-
`agent.reason` carries `codex-home-is-link`, `skills-dir-is-link`, `skill-dir-is-link`, `agents-dir-is-link` or
|
|
638
|
-
`boundary-unverified` in that case, so the page can say which boundary it refused.
|
|
639
|
-
|
|
640
|
-
`agent.expect` and `mcp.marked` are the two ownership facts: `expect` is what a
|
|
641
|
-
refresh compares against immediately before its rename, and `marked` is true only
|
|
642
|
-
when the entry carries the plugin marker (i.e. when a `remove` may delete it).
|
|
643
|
-
|
|
644
|
-
`switch` reports the DSH posture and always carries
|
|
645
|
-
`changedByThisAction: false`: no Codex action can authorize dispatch.
|
|
646
|
-
|
|
647
|
-
---
|
|
648
|
-
|
|
649
|
-
## 4.1 The preflight tool the skill depends on
|
|
650
|
-
|
|
651
|
-
`delegate_preflight` is a strictly read-only MCP tool that is not an
|
|
652
|
-
authorization at all: it is a read-only measurement of one workspace, added so a
|
|
653
|
-
dispatcher learns *before* submitting that a checkout is dirty, is not a
|
|
654
|
-
repository, or needs an isolation decision — instead of learning it from a job that
|
|
655
|
-
failed after admission.
|
|
656
|
-
|
|
657
|
-
| property | value |
|
|
658
|
-
|---|---|
|
|
659
|
-
| tool | `delegate_preflight` |
|
|
660
|
-
| arguments | `workspacePath` (string, required, absolute), `allowShared` (boolean, optional) |
|
|
661
|
-
| schema | closed: `additionalProperties: false`; `allowShared` must be a real boolean (`MCP_ARGUMENT_TYPE` otherwise, and the plane is never reached) |
|
|
662
|
-
| execution-plane route | `POST /dsh-delegate/x/workspace/preflight` |
|
|
663
|
-
| writes | nothing: no commit, stash, branch, worktree, lock, task, grant or setting |
|
|
664
|
-
| gate | transport fence + connection identity only — **not** the switch, because it authorizes nothing |
|
|
665
|
-
|
|
666
|
-
The answer is `{ ok, readOnly, workspacePath, isolation, reason, sharedExplicit,
|
|
667
|
-
decisionRequired, facts, guidance, checkedAt }` with `isolation` one of
|
|
668
|
-
`worktree` / `shared` / `block` and `reason` a stable `PREFLIGHT_*` code. The full
|
|
669
|
-
shape, the decision table and the four git reads it is allowed to issue are stated
|
|
670
|
-
in `docs/workspace-contract.md` §3.5; this document only records the contract the
|
|
671
|
-
agent file depends on.
|
|
672
|
-
|
|
673
|
-
The one rule a reviewer should check: **a dirty repository is never downgraded
|
|
674
|
-
automatically.** Without `allowShared` the answer is `block` with
|
|
675
|
-
`decisionRequired: true`; with `allowShared: true` — a per-call decision record,
|
|
676
|
-
never a stored preference — it is `shared` with `sharedExplicit: true`. The Codex
|
|
677
|
-
coordinator evaluates the requested task and changed paths and may decide to use
|
|
678
|
-
shared isolation without asking on every dispatch; it pauses when ownership or risk
|
|
679
|
-
is unclear. To make the actual job match that decision, `delegate_submit` passes
|
|
680
|
-
only `{ isolation: "shared" }` as an override. Provider, model, effort and timeout
|
|
681
|
-
remain those selected in the plugin settings.
|
|
682
|
-
|
|
683
|
-
---
|
|
684
|
-
|
|
685
|
-
## 5. Skill ownership & historical legacy TOML identities
|
|
686
|
-
|
|
687
|
-
From `1.9.0`, the active shipped file is the Markdown skill `$CODEX_HOME/skills/dsh-taskbridge/SKILL.md`
|
|
688
|
-
(with `<!-- dsh-taskbridge-version: 1.9.
|
|
689
|
-
Earlier `0.1.6`–`1.8.x` releases shipped a custom-agent TOML file:
|
|
690
|
-
|
|
691
|
-
```toml
|
|
692
|
-
version = "1.0.0" # stamped from package.json in 0.1.6–1.8.x legacy builds
|
|
693
|
-
name = "dsh-delegate"
|
|
694
|
-
description = "…"
|
|
695
|
-
developer_instructions = """…"""
|
|
696
|
-
```
|
|
697
|
-
|
|
698
|
-
Neither the active `SKILL.md` nor the historical `.toml` files contain an `[mcp_servers.*]`
|
|
699
|
-
table, because the session/agent uses the parent Codex `config.toml` MCP registration, and a
|
|
700
|
-
second definition would start a second server.
|
|
701
|
-
|
|
702
|
-
**Ownership is content identity, not a heuristic.** `readAgentState` reports:
|
|
703
|
-
|
|
704
|
-
* `installed` — same text (admitting only `\r\n` vs `\n` line-terminator spelling, rejecting lone `\r`) as the `SKILL.md` this build renders, with an intact matching reference file;
|
|
705
|
-
* `outdated` — same text as one of the enumerated `KNOWN_SKILL_TEMPLATES` (`1.9.0` prereleases) or a recorded `codex-skill-ownership` digest for THIS Codex home (section 5.0); meanwhile `legacyAgents` classifies untouched `0.1.6`–`1.8.x` `.toml` files against `KNOWN_AGENT_TEMPLATES` and historical `codex-agent-ownership` records as `managed-legacy` for automatic retirement;
|
|
706
|
-
* `modified`/`conflict` — everything else.
|
|
707
|
-
|
|
708
|
-
Every release from `0.1.10` through `0.1.13` changes only the version line in the
|
|
709
|
-
companion file, so those templates share one body and differ only in that stamped line.
|
|
710
|
-
`0.1.14` changes the body as well (the per-call decision rules below), which is why its
|
|
711
|
-
predecessor is enumerated as a pinned identity rather than rebuilt. The bytes are what
|
|
712
|
-
ownership is proved against, so every release is enumerated on its own:
|
|
713
|
-
|
|
714
|
-
| Release | Digest enumerated in `KNOWN_AGENT_TEMPLATES` |
|
|
715
|
-
| --- | --- |
|
|
716
|
-
| `0.1.10` | `fc7b27104dbb50f4e614cd4fd8df8db87fd8f59fcf2b3c27b412b49f8b89fbba` (packed CRLF) |
|
|
717
|
-
| `0.1.10` | `6583f08a3ec4912a875249e6b127357b41cc3f8bf388b8e5cadbbeff469349be` (same template, LF) |
|
|
718
|
-
| `0.1.11` | `b6ca7c3258fc00c1c1682abf099994b9f5abe650acc3ecf9635eec4a35520151` (packed) |
|
|
719
|
-
| `0.1.12` | `ff04a4bf2c09b97747f835770c837637869581bb13bad3b8a870a3e92218514f` (packed) |
|
|
720
|
-
| `0.1.13` | `b3a1d2f0520774c0066ea733f27fd47c67c5f5ac44394d0eec2564c7959700aa` (packed, 9191 bytes, CRLF) |
|
|
721
|
-
| `0.1.14` | `11379c0152f3fb2bd4da1170812e51fe68006d98f6378c720cbadcee9ee4750c` (packed) |
|
|
722
|
-
| `1.0.0` | `b1fd531598087564b26df14d3261515e961012f3fd010ea493f222da7bbaf415` (git release bytes, CRLF) |
|
|
723
|
-
| `1.0.0` | `0cce75574107049413f4ddbdf7d8e6cddea92d45a0c4e0fa41b169cb790e5e13` (same template, LF) |
|
|
724
|
-
| `1.0.0` | `a8c888afaa0a1a6a0abfcb56670ffbdb67697f07e54871ece78c8adffb15c149` (**legacy** pinned identity) |
|
|
725
|
-
| `1.0.0` | `f51831e2ff265c9ba63a4760e245787060de7bd91dcc9663a11729fb472e5f62` (**legacy** pinned identity) |
|
|
726
|
-
| `1.1.0` | `7d3ea5c54647a92cebaa0521741eb27f5141f7b2127b47009195fdb976dae4fb` (git release bytes, CRLF) |
|
|
727
|
-
| `1.1.0` | `93d580bd849bb6d2c30c2db6286695ef3e0356896a88e552abae5f03eafc7601` (same template, LF) |
|
|
728
|
-
|
|
729
|
-
The `1.0.0` and `1.1.0` **git-verified** identities come from the release commits
|
|
730
|
-
themselves — `git show 2750047:codex/dsh-delegate.toml` and
|
|
731
|
-
`git show 2d71708:codex/dsh-delegate.toml` — and are kept as fixtures
|
|
732
|
-
(`tests/fixtures/codex-agent-1.0.0.toml`, `…-1.1.0.toml`) that are never packed.
|
|
733
|
-
|
|
734
|
-
The two **legacy** `1.0.0` entries are NOT claimed to be the Git bytes: the fixture above
|
|
735
|
-
is what the release commit contains, and these digests do not match it. They are retained
|
|
736
|
-
because a released build enumerated them, so an installation created by that build stays
|
|
737
|
-
structurally refreshable instead of flipping to "somebody else's file". Labelling them
|
|
738
|
-
`legacy` is the point: keeping an old identity is conservative (an unrecognised file is
|
|
739
|
-
never adopted and never removable), while pretending it came from Git would be a false
|
|
740
|
-
claim.
|
|
741
|
-
|
|
742
|
-
`0.1.10` therefore carries **two** entries, because that release exists in two byte forms
|
|
743
|
-
and either one can be on disk: the CRLF file inside the packed
|
|
744
|
-
`dsh-delegate-0.1.10.tgz`, and the same template kept as LF text. Both are hashes of
|
|
745
|
-
actual published bytes — the LF digest is an exact identity, not a normalized comparison.
|
|
746
|
-
`0.1.11` was delivered as an uncommitted candidate plus a verified tarball (the last
|
|
747
|
-
commit, `a750c0b`, is `0.1.10`), so that digest is cited from the tarball and the saved
|
|
748
|
-
baseline rather than from a `0.1.11` commit. The `0.1.12` digest is likewise verified
|
|
749
|
-
against the `package/codex/dsh-delegate.toml` inside the packed
|
|
750
|
-
`dsh-delegate-0.1.12.tgz` and against the saved release baseline. No earlier digest was
|
|
751
|
-
removed or replaced when a later release was added, so a machine that skipped a release is
|
|
752
|
-
still migrated directly to this build.
|
|
753
|
-
|
|
754
|
-
`0.1.13` is the last release whose companion body is the older one: `0.1.14` added the
|
|
755
|
-
per-call permission decision rules, so the `0.1.13` bytes are **not** recoverable by
|
|
756
|
-
relabelling the current template and are enumerated as an exact identity instead. The
|
|
757
|
-
digest was verified against `package/codex/dsh-delegate.toml` inside the packed
|
|
758
|
-
`dsh-delegate-0.1.13.tgz` (9191 bytes, CRLF) and the file is kept as
|
|
759
|
-
`tests/fixtures/codex-agent-0.1.13.toml`, so the "unchanged `0.1.13` is refreshed" and
|
|
760
|
-
"edited `0.1.13` is preserved" cases are both driven by real published bytes.
|
|
761
|
-
|
|
762
|
-
**Line endings in classification vs. write/delete verification (`1.5.3+`).** Classification
|
|
763
|
-
(`sameAgentText` and `isKnownPriorTemplate`) folds `\r\n` to `\n` (while rejecting any leftover
|
|
764
|
-
lone `\r`, BOM, tab, trailing space, blank line or version edit) so uniform LF, uniform CRLF, and
|
|
765
|
-
mixed CRLF/LF spellings of the exact same published template are recognized without false conflicts;
|
|
766
|
-
new managed files are written in LF, and every overwrite or unlink still re-reads the file and
|
|
767
|
-
requires its exact raw bytes to match `expect`. Both LF and CRLF digests of historical releases
|
|
768
|
-
remain enumerated in `KNOWN_AGENT_TEMPLATES` / `KNOWN_SKILL_TEMPLATES` and pinned by
|
|
769
|
-
`tests/codex-integration.test.js` and `tests/codex-agent-line-endings.test.js`.
|
|
770
|
-
|
|
771
|
-
A digest is added only for a build that was actually packed and verified, and the
|
|
772
|
-
current template's digest is never in the list under an older label; the tests assert
|
|
773
|
-
both facts (`tests/codex-integration.test.js`, `tests/package.test.js`).
|
|
774
|
-
|
|
775
|
-
The 1.7.0 package recognized these two earlier companion versions, each in both
|
|
776
|
-
terminator spellings, and all four are exact identities like every entry above:
|
|
777
|
-
|
|
778
|
-
| Release | Digest enumerated in `KNOWN_AGENT_TEMPLATES` |
|
|
779
|
-
| --- | --- |
|
|
780
|
-
| `1.6.1` | `efdef5f6e6ebcb26590ca929e674391b3c4fcdb3c017714d2322615783fdf712` (all LF) |
|
|
781
|
-
| `1.6.1` | `5da9fd5eb5a89fd3c76365faca78b51e34233d993605f1b55dff4b07ceb88b80` (same template, CRLF) |
|
|
782
|
-
| `1.6.1-test.5` | `bf698c861e7e560c555f8350b711db88627dce4a8752b2cbebe8748b6d640d37` (the packed agent, LF) |
|
|
783
|
-
| `1.6.1-test.5` | `a45e12d0b234e80854e69429518a2def2d00338f968c2ecfc689307b792e4426` (same file, CRLF) |
|
|
784
|
-
|
|
785
|
-
Both carried the SAME instruction body in the 1.6.1 sources and differed only in the
|
|
786
|
-
stamped `version` line, so enumerating both avoided false `modified` conflicts on upgrade.
|
|
787
|
-
|
|
788
|
-
At plugin startup, an `outdated` agent is refreshed automatically only when its
|
|
789
|
-
bytes still match a known shipped build. This does not create a missing agent or
|
|
790
|
-
edit `config.toml`. A file with any other content is preserved, even when its
|
|
791
|
-
version line names an older release.
|
|
792
|
-
|
|
793
|
-
Since 1.2.0 the startup check has a second half: an **already installed** managed
|
|
794
|
-
`mcp_servers.dsh-delegate` entry that is merely `outdated` is upgraded in place (see
|
|
795
|
-
section 2.4). It is still not an install: no entry is created, and no entry the plugin
|
|
796
|
-
cannot prove it wrote is adopted or rewritten.
|
|
797
|
-
|
|
798
|
-
The version line is *never* the proof. A file that still starts with the managed
|
|
799
|
-
header, still contains the dispatch rules, but has an old or invented version line
|
|
800
|
-
and one edited body byte is the operator's: the digest no longer matches, so it is
|
|
801
|
-
`modified`, it is never refreshed, and it is never removed. Conversely a
|
|
802
|
-
byte-exact published build is refreshed and removable, as documented.
|
|
803
|
-
|
|
804
|
-
### 5.0 The recorded template digest (future releases)
|
|
805
|
-
|
|
806
|
-
Enumerating every future release by hand does not scale, so one small record exists beside the
|
|
807
|
-
table: after an **explicit `install`** or the startup **`refreshKnownAgentTemplate`** has written
|
|
808
|
-
the agent file, and only when the file it re-reads is exactly the template this build renders,
|
|
809
|
-
the plugin stores the digest of those bytes.
|
|
810
|
-
|
|
811
|
-
* Path (1.9.0+ native skill): `<DSH_HOME>/data/dsh-delegate/codex-skill-ownership/<sha256 of the real home>.json` — one
|
|
812
|
-
file per pinned Codex home, named by a digest of that home so no case equivalence is ever
|
|
813
|
-
inferred and two homes can never collide. Legacy `<DSH_HOME>/data/dsh-delegate/codex-agent-ownership/`
|
|
814
|
-
records remain readable so untouched pre-1.9.0 `.toml` subagents migrate cleanly.
|
|
815
|
-
* `npm run build:integrations` assembles `SKILL.md` and its rules reference from the shared
|
|
816
|
-
Layer 2 rules in `integrations/core/` through the Layer 1 Codex adapters.
|
|
817
|
-
* Content: `{ "schemaVersion": 1, "codexHome": "<real home>", "templateLfSha256": "<64 hex>" }`.
|
|
818
|
-
The digest is **LF-normalized** (the CRLF/LF spelling is not content, exactly as the table
|
|
819
|
-
treats it), and it is the only digest. No template body, no `config.toml`, no model
|
|
820
|
-
setting, no version, no timestamp, no credential.
|
|
821
|
-
* A file whose digest equals that value is `outdated`. One changed character — an added line, a
|
|
822
|
-
tab, or a rewritten `version` line — hashes differently and stays `modified`.
|
|
823
|
-
* The record is read only: `status`, `repair` and `remove` never write it. A record reached
|
|
824
|
-
through a link or reparse point, missing, unreadable, malformed, over 4 KB, or naming a
|
|
825
|
-
different home is **no record** — the file is then classified by its content alone. A read
|
|
826
|
-
never creates the record directory; a write proves each level first and is atomic, owner-only,
|
|
827
|
-
and read back. An unchanged record is not rewritten. A `DSH_HOME` override must be absolute;
|
|
828
|
-
without one the `~/.dsh` default applies.
|
|
829
|
-
* A failure to record costs the next release one enumeration. It never fails an install and
|
|
830
|
-
never changes how a file is classified.
|
|
831
|
-
|
|
832
|
-
The version line is *never* the proof. A file that still starts with the managed
|
|
833
|
-
header, still contains the dispatch rules, but has an old or invented version line
|
|
834
|
-
and one edited body byte is the operator's: the digest no longer matches, so it is
|
|
835
|
-
`modified`, it is never refreshed, and it is never removed. Conversely a
|
|
836
|
-
byte-exact published build is refreshed and removable, as documented.
|
|
837
|
-
|
|
838
|
-
### From the project plan to a DSH assignment
|
|
839
|
-
|
|
840
|
-
Codex checks the relevant code and earlier deliverables before deciding the next
|
|
841
|
-
step. It tells the operator which packet is ready, how it will work, and what it
|
|
842
|
-
will reuse. The `delegate_submit.prompt` carries the plan DSH executes. Include the
|
|
843
|
-
starting point, implementation order, scope and evidence for acceptance. For
|
|
844
|
-
multi-stage work, keep dependencies and reviewed progress in the existing plan tree.
|
|
845
|
-
The worker handles routine implementation choices and reports verified facts that
|
|
846
|
-
would change the agreed approach. Codex reviews the evidence before advancing
|
|
847
|
-
work that depends on it.
|
|
848
|
-
|
|
849
|
-
### 5.1 Required dispatch semantics
|
|
850
|
-
|
|
851
|
-
The instructions must state all of the following. They are asserted in
|
|
852
|
-
`tests/codex-integration.test.js` and `tests/package.test.js`, so an edit that drops
|
|
853
|
-
one fails the build:
|
|
854
|
-
|
|
855
|
-
1. **Explicit assignment only.** Dispatch only when the user explicitly
|
|
856
|
-
selects this skill (`$dsh-taskbridge`) or explicitly asks to delegate a Git
|
|
857
|
-
repository code implementation or verification task to DSH / TaskBridge.
|
|
858
|
-
2. **Mention is not dispatch.** Text that merely mentions DSH, DeepSeek,
|
|
859
|
-
dsh-delegate, delegation or the agent while asking something else is not a
|
|
860
|
-
dispatch request, and neither is a question about the plugin, its settings or
|
|
861
|
-
its status.
|
|
862
|
-
3. **No dispatch for non-implementation work.** Explanation, planning,
|
|
863
|
-
review-only, summarising and status questions are answered in Codex.
|
|
864
|
-
4. **Ambiguity is a question.** If it is unclear whether the task was assigned, ask
|
|
865
|
-
once instead of dispatching.
|
|
866
|
-
5. **Switch first, facts second.** Call `delegate_status` first (once per session); then call
|
|
867
|
-
`delegate_preflight` with the exact authorized workspace path (or pass `autoPreflight: true, wait: true` on `delegate_submit` for a normal single-repo dispatch, resuming via `delegate_wait` on `submitReceipt.taskId` if `submitted: true` returns with `waitError`). If either fails,
|
|
868
|
-
the tool is missing, the switch is off, or the answer is ambiguous, stop and
|
|
869
|
-
report the bounded refusal. Leave the switch as set and use only the authorized
|
|
870
|
-
TaskBridge execution path.
|
|
871
|
-
6. **The isolation is decided from the measured facts, and never downgraded.**
|
|
872
|
-
`delegate_preflight` returns `isolation` (`worktree` / `shared` / `block`) and a
|
|
873
|
-
stable `reason` code:
|
|
874
|
-
* `worktree` (`PREFLIGHT_CLEAN_REPOSITORY`) — a clean repository; dispatch with
|
|
875
|
-
the worktree isolation selected in the plugin settings, unchanged.
|
|
876
|
-
* `block` + `decisionRequired: true` (`PREFLIGHT_DIRTY_NEEDS_DECISION`) — the
|
|
877
|
-
checkout is dirty, so a worktree cannot be prepared from a commit. The agent
|
|
878
|
-
must **not** silently downgrade and must **not** probe by submitting. As
|
|
879
|
-
coordinator, it inspects the changed-file count and bounded path list and
|
|
880
|
-
decides whether this authorized task can safely run in place while preserving
|
|
881
|
-
the existing changes. It need not ask the operator to choose on every dispatch:
|
|
882
|
-
it states a safe shared decision and its reason before dispatch, re-runs the
|
|
883
|
-
preflight with `allowShared: true`, and proceeds only if the answer is `shared`
|
|
884
|
-
(`PREFLIGHT_DIRTY_SHARED_EXPLICIT`). If ownership, overlap or risk is unclear,
|
|
885
|
-
it pauses for one focused question.
|
|
886
|
-
* `block` for any other reason (`PREFLIGHT_GIT_UNAVAILABLE`,
|
|
887
|
-
`PREFLIGHT_NOT_A_REPOSITORY`, `PREFLIGHT_NO_COMMITS`, `PREFLIGHT_GIT_FAILED`,
|
|
888
|
-
`PREFLIGHT_WORKSPACE_INVALID`, `PREFLIGHT_NOT_A_DIRECTORY`) — stop and report
|
|
889
|
-
the code; no fallback exists.
|
|
890
|
-
7. **The dispatch text carries the workspace facts and the isolation reason.** A
|
|
891
|
-
shared run is named as such, because the worker writes into a checkout that
|
|
892
|
-
already has uncommitted work.
|
|
893
|
-
8. **Route settings stay in the plugin.** For `worktree`, call `delegate_submit`
|
|
894
|
-
without `overrides` so the configured isolation applies. For an explicitly chosen
|
|
895
|
-
`shared` run, pass only `{ isolation: "shared" }` as the per-task override because
|
|
896
|
-
the plugin may still be configured for `worktree`. Never override provider,
|
|
897
|
-
model, effort or timeout, and never encode a route in the prompt. `allowShared`
|
|
898
|
-
on preflight records the decision but does not change the submitted job's
|
|
899
|
-
isolation by itself.
|
|
900
|
-
9. **One task, WAITED — not polled (1.1.0).** Keep the returned `taskId` and call
|
|
901
|
-
`delegate_wait({ taskId })` — with no `waitSeconds` argument — repeating it until it
|
|
902
|
-
returns a reason that needs the host. `delegate_result` is **not** a polling loop: one
|
|
903
|
-
`delegate_wait` blocks internally and re-issues its own bounded observation requests,
|
|
904
|
-
which is the waiting loop. Never submit a duplicate because a task is still running;
|
|
905
|
-
`delegate_cancel` stops it. The wait defaults to 3600 seconds and the tool caps it
|
|
906
|
-
there, so there is nothing to raise: when a wait ends, call it again on the same task.
|
|
907
|
-
A shorter explicit `waitSeconds` stays legal but is only for a one-off diagnostic the
|
|
908
|
-
operator explicitly asked for.
|
|
909
|
-
While the wait runs, stay silent: do not read intermediate code or diffs, do not run
|
|
910
|
-
parallel implementation or research, and do not narrate unchanged snapshots. The only
|
|
911
|
-
exceptions are work explicitly assigned as independent of the task, an inspection the
|
|
912
|
-
operator explicitly asked for, a decision or diagnosis that genuinely needs a fact the
|
|
913
|
-
wait did not return, and an explicit user-authorized takeover. Review happens once, on
|
|
914
|
-
delivery.
|
|
915
|
-
`heartbeat` means "nothing to report" and is internal: the tool re-waits rather than
|
|
916
|
-
handing it to the model, so normal progress never wakes Codex.
|
|
917
|
-
The roughly 25-second internal observation cadence belongs to the program, not to the
|
|
918
|
-
agent: it is not a polling rate the model should imitate.
|
|
919
|
-
10. **Each wait reason has a stated policy (1.1.0+; delivery interval 40 min default from 1.7.0).**
|
|
920
|
-
- `attention` — either the run progress check (no new result delivered back to the host for the
|
|
921
|
-
operator-configured progress-check interval — **40 minutes by default**, adjustable or
|
|
922
|
-
disableable) or a `repeated-tool-failure` reminder. It does **not** mean an ordinary wait
|
|
923
|
-
ended: a wait ending is `wait-limit`. It is a QUESTION, not a verdict: read the compact
|
|
924
|
-
diagnostic (phase, last activity, current tool and its elapsed time, self-check
|
|
925
|
-
verdict) and **default to waiting again** on the same task. Never cancel, never mark
|
|
926
|
-
failed, and never resubmit merely because a task is quiet or one tool or test is
|
|
927
|
-
slow. Only a concrete, stated error justifies anything else, and then it is reported
|
|
928
|
-
rather than silently restarted.
|
|
929
|
-
- `permission` — a per-call decision is outstanding; see item 12. After deciding,
|
|
930
|
-
wait the SAME task again.
|
|
931
|
-
- `ready` — execution finished and the task awaits **host review**; that is not
|
|
932
|
-
acceptance. Read `delegate_result` **once** for full evidence and review it in
|
|
933
|
-
Codex. A large diff is inspected file by relevant file, once each, not re-read.
|
|
934
|
-
- `failed` / `cancelled` — read `delegate_result` once for the recorded reason and
|
|
935
|
-
report it; do not resubmit identical work hoping for a different outcome.
|
|
936
|
-
- `wait-limit` — this call's own wait budget ran out with nothing changed. The answer
|
|
937
|
-
carries `actionable: false` and `terminal: false`: it is not a result, requires no
|
|
938
|
-
business decision, and ends nothing. Immediately `delegate_wait` the same task
|
|
939
|
-
again (no `waitSeconds`). It is not a failure, a stall, or a reason to submit
|
|
940
|
-
anything new or to check the implementation locally.
|
|
941
|
-
A **client-side tool timeout** is a different event and is *not* `wait-limit`: the
|
|
942
|
-
host's own limit ending the call does not prove the execution stopped, and does not
|
|
943
|
-
prove it is alive. Keep the `taskId` and wait again; if a compact fact is genuinely
|
|
944
|
-
needed, read it with `delegate_result`. Never duplicate, restart or cancel a task
|
|
945
|
-
because a wait or a client timeout ended.
|
|
946
|
-
- `interrupted` — **the wait was cut off; that is not by itself a finished
|
|
947
|
-
execution.** One call answers it at once (it does not loop), so the answer's own
|
|
948
|
-
fields decide the response (1.2.0):
|
|
949
|
-
* `terminal: false` with a live `state` (`running`/`pending`): the task is running.
|
|
950
|
-
`delegate_wait` the same task; never resubmit, never implement locally, never
|
|
951
|
-
cancel for this reason.
|
|
952
|
-
* `terminal: true` and `state: "interrupted"`: the TASK record itself is a restart
|
|
953
|
-
history and will not resume. Read `delegate_result` once and report; do not keep
|
|
954
|
-
calling `delegate_wait` on it.
|
|
955
|
-
* `terminal: false` with no state, an unrecognized state, or a state that
|
|
956
|
-
contradicts the record (for example `running` with an end time): neither
|
|
957
|
-
"running" nor "stopped" may be assumed. Keep the task id and check one fact with
|
|
958
|
-
`delegate_result` before deciding — and do not re-wait indefinitely on a task the
|
|
959
|
-
host cannot classify.
|
|
960
|
-
A settled state carried by an `interrupted` observation is reported as that real
|
|
961
|
-
outcome (`awaiting-host-review` → `ready`), so a completed run always reaches review.
|
|
962
|
-
10b. **When the host blocks the connection, the control channel is separate (1.2.0).**
|
|
963
|
-
Some hosts forward one tool call at a time, so a long `delegate_wait` blocks
|
|
964
|
-
`delegate_status`/`delegate_cancel` on that same MCP connection. When — and only
|
|
965
|
-
when — the operator asks to stop or inspect that task in that situation, the agent
|
|
966
|
-
may run `dsh-delegate-control status <taskId>` or
|
|
967
|
-
`dsh-delegate-control cancel <taskId>` from the SAME package directory as the
|
|
968
|
-
configured MCP script (derived from this plugin's own MCP `args[0]`, never another
|
|
969
|
-
script), using the same `node` executable. It cannot submit, change a setting or
|
|
970
|
-
the switch, act on another task, resubmit the work or switch models, and during a
|
|
971
|
-
normal wait it stays silent instead of polling that binary.
|
|
972
|
-
|
|
973
|
-
What the command guarantees, so the expected output is never mistaken for a hang:
|
|
974
|
-
`status` reads the task's CURRENT compact state through ONE observation with the
|
|
975
|
-
smallest positive wait (`waitMs: 1`) — not `waitMs: 0`, which the engine reads as
|
|
976
|
-
"no bound requested" and replaces with a 25-second long poll. The commands answer
|
|
977
|
-
inside a single budget (10 s by default; `DSH_DELEGATE_CONTROL_TIMEOUT_MS` may only
|
|
978
|
-
lower it), enforced through one caller `AbortSignal` with the observation retry
|
|
979
|
-
disabled for that call, so a dead endpoint cannot spend a backoff schedule after
|
|
980
|
-
the answer. A failure — including an exhausted budget, `CONTROL_TIMEOUT` — is one
|
|
981
|
-
bounded JSON document on stdout plus a non-zero exit code, never a stack trace.
|
|
982
|
-
11. **Evidence, not approval.** Return state, the actual provider/model/effort,
|
|
983
|
-
changed-file summary, verification evidence, limitations, and the preflight
|
|
984
|
-
facts with the isolation reason actually used. Executing is not accepting:
|
|
985
|
-
Codex remains responsible for review. Do not claim a check passed without
|
|
986
|
-
evidence, and never commit or push.
|
|
987
|
-
12. **The workspace is not tidied up to pass a check.** No commit, stash, branch,
|
|
988
|
-
worktree creation, `clean`, `reset` or revert on the operator's behalf. A dirty
|
|
989
|
-
workspace is an isolation decision for the coordinator; pause only when the
|
|
990
|
-
existing edits' ownership or risk is unclear.
|
|
991
|
-
13. **A task awaiting a permission decision is still running, and the coordinating
|
|
992
|
-
Codex decides it.** A wait reporting `permission` (with the full redacted request
|
|
993
|
-
at the top level) is the worker paused on one native tool call, not a
|
|
994
|
-
stall: never submit a duplicate, mark it failed, or cancel it merely because it
|
|
995
|
-
waits, and keep waiting the SAME task. The agent does **not** invoke a second
|
|
996
|
-
approval/review model, does **not** ask the operator to choose routine within-task
|
|
997
|
-
decisions, and does **not** delegate the decision to the worker. The worker's own
|
|
998
|
-
`reason` is a claim, never authority. It checks the actual tool, redacted
|
|
999
|
-
arguments, call identity, session and repository against the authorized task,
|
|
1000
|
-
reading local evidence when it needs to understand an executable script or target,
|
|
1001
|
-
and approves only the specific operation the task needs — refusing anything
|
|
1002
|
-
unrelated, destructive or exfiltrating, any credential or configuration change, and
|
|
1003
|
-
any request whose evidence is unknown or materially incomplete. An allow requires
|
|
1004
|
-
`argumentsComplete: true`, `completeness: complete`, `allowBlocked: null`, no
|
|
1005
|
-
transport truncation affecting the pending operation, a still-pending request and
|
|
1006
|
-
its exact `fingerprint`, passed to `delegate_permission_decide` with the `taskId`,
|
|
1007
|
-
`requestId`, `decision` (`allow-once`/`reject`) and a bounded `reason`. An invalid or
|
|
1008
|
-
stale allow grants nothing: re-read the current request and decide safely, and never
|
|
1009
|
-
retry under broader settings. Resume waiting on the same task after the decision.
|
|
1010
|
-
Each approval covers one call (`scope: "once"`). The release treats the preview
|
|
1011
|
-
value `scope: "task-command"` on an `allow-once` request as a single-call approval.
|
|
1012
|
-
Make a fresh decision for each subsequent approval request. When dispatching on
|
|
1013
|
-
behalf of a parent commander, preserve the complete request evidence for that commander.
|
|
1014
|
-
14. **No local implementation while a delegated worker runs (1.1.0).** Neither the
|
|
1015
|
-
dispatch companion nor the parent commander writes, patches or "just fixes" the
|
|
1016
|
-
implementation while a delegated task is running, waiting, or awaiting review: that
|
|
1017
|
-
would make the reviewer a second implementer of the same change, produce conflicting
|
|
1018
|
-
edits in one workspace, and break the single-writer property the isolation mode
|
|
1019
|
-
provides. The only exception is an explicit, user-authorized takeover — the operator
|
|
1020
|
-
saying to take over and implement it here. A long silence, a permission refusal, a
|
|
1021
|
-
failed run, a wait-limit or the commander's own opinion of the plan is **not** that
|
|
1022
|
-
authorization. Permitted local actions while a task runs are: reading status and
|
|
1023
|
-
diagnostics, waiting, reading evidence, deciding a pending permission, cancelling,
|
|
1024
|
-
and writing the follow-up prompt. A believed-wrong result is reported and proposed
|
|
1025
|
-
as a follow-up in the same chain, never applied locally.
|
|
1026
|
-
15. **No secrets.** Never read, request, store or relay provider credentials or
|
|
1027
|
-
connection tokens.
|
|
1028
|
-
16. **Task threads are explicit.** A submission starts a NEW DSH task conversation
|
|
1029
|
-
by default; a directory-level reuse setting no longer exists. `continueFromTaskId`
|
|
1030
|
-
is passed **only** for a follow-up change, correction or retry that belongs to one
|
|
1031
|
-
earlier delegated task, and its value is the latest prior task id of that chain.
|
|
1032
|
-
An unrelated task, a new topic or a different workspace omits `continueFromTaskId` entirely:
|
|
1033
|
-
an id is never reused "to keep context" and never guessed. For a new dependent multi-stage subtask that starts a fresh DSH Session directly on an earlier accepted isolated worktree under the same source repository, pass `reuseWorktreeFromTaskId` instead (never combined with `continueFromTaskId`). A follow-up to a
|
|
1034
|
-
`worktree` task keeps its original source `workspacePath` for preflight and
|
|
1035
|
-
submit; the plugin resolves the same internal tree and continues its earlier
|
|
1036
|
-
uncommitted changes there. Never send the tree's internal execution path as the
|
|
1037
|
-
authorization path or choose a new isolation override. A refusal naming an
|
|
1038
|
-
unavailable or mismatched tree is reported and escalated, never worked around
|
|
1039
|
-
by re-submitting as a new task. The run's report states which of the two happened.
|
|
1040
|
-
Corrections are consolidated into one follow-up submission rather than a scatter of
|
|
1041
|
-
new tasks.
|
|
1042
|
-
|
|
1043
|
-
### 5.2 Native Skill invocation (`$dsh-taskbridge`, 1.9.0+) vs. legacy `@` selection
|
|
1044
|
-
|
|
1045
|
-
From `1.9.0`, TaskBridge installs a **native Codex Skill** at
|
|
1046
|
-
`$CODEX_HOME/skills/dsh-taskbridge/SKILL.md`. An explicit `$dsh-taskbridge` activation or request
|
|
1047
|
-
to delegate to DSH / TaskBridge loads the entry. The active Codex session calls `delegate_submit` + a single direct `delegate_wait` chain without spawning
|
|
1048
|
-
a `spawn_agent` / `wait_agent` polling wrapper.
|
|
1049
|
-
|
|
1050
|
-
For pre-1.9.0 legacy subagent installations (`$CODEX_HOME/agents/dsh-taskbridge.toml`), this
|
|
1051
|
-
plugin never claimed `@dsh-taskbridge` picker support across all Codex builds. A new Codex session
|
|
1052
|
-
(or restart) is required after install or migration so Codex reloads the native skill and MCP entry.
|
|
1053
|
-
|
|
1054
|
-
---
|
|
1055
|
-
|
|
1056
|
-
## 6. Failure modes a reviewer should check
|
|
1057
|
-
|
|
1058
|
-
| Situation | Expected |
|
|
1059
|
-
| --- | --- |
|
|
1060
|
-
| `CODEX_HOME` relative | 400 `CODEX_HOME_INVALID`; nothing read or written |
|
|
1061
|
-
| `CODEX_HOME` unset | diagnosed against `~/.codex` |
|
|
1062
|
-
| `$CODEX_HOME` is a normal symlink or Windows junction | pin and verify its real directory target, preserve the root alias, then apply the same managed-content checks; broken or unverifiable targets are refused |
|
|
1063
|
-
| `$CODEX_HOME/skills`, `skills/dsh-taskbridge`, or `agents` is a symlink or Windows junction | `conflict` (`skills-dir-is-link` / `skill-dir-is-link` / `agents-dir-is-link`); install/repair/remove refuse with `AGENT_PATH_CONFLICT` and no file is created outside the home |
|
|
1064
|
-
| an ordinary real Windows directory | `directory` in every spelling of the helper's boolean (`dir/False`, `dir/false`); never reported as a link |
|
|
1065
|
-
| `repair` with the skill file missing or `outdated` | `changed: ["mcp"]` or `[]`; the skill file is not created and not refreshed, and neither `skills/` nor `agents/` is created |
|
|
1066
|
-
| the boundary cannot be verified (no spawnable shell / no PowerShell) | `conflict` (`boundary-unverified`); everything refused, nothing assumed safe |
|
|
1067
|
-
| `skills/dsh-taskbridge` dir missing | created on explicit `install` (`0700`) when the boundary is clean |
|
|
1068
|
-
| `skills/dsh-taskbridge/SKILL.md` is a symlink or a directory | `conflict`; untouched |
|
|
1069
|
-
| a different skill file appears between status and install | `modified`; untouched (first install is exclusive) |
|
|
1070
|
-
| a skill file is rewritten between the status read and `remove` | `AGENT_USER_MODIFIED` (`modified-before-removal`); the new bytes are kept |
|
|
1071
|
-
| the skill path is replaced by a directory / a link before `remove` | `AGENT_PATH_CONFLICT`; the entry is left in place |
|
|
1072
|
-
| an edited skill file with an old version comment | `modified` (`reason: edited` if body matches current template); never refreshed, never removed |
|
|
1073
|
-
| a byte-exact previously published skill or legacy `.toml` | `outdated` / `managed-legacy`; refreshed/migrated on install or startup refresh, removed on `remove` |
|
|
1074
|
-
| `config.toml` is a symlink | `unreadable`; refused |
|
|
1075
|
-
| `config.toml` > 1 MiB | refused (`other`), untouched |
|
|
1076
|
-
| `config.toml` contains a NUL / control character | `CODEX_CONFIG_UNSUPPORTED`, untouched |
|
|
1077
|
-
| `config.toml` uses CRLF | edited in place; CRLF and every unrelated byte preserved |
|
|
1078
|
-
| an unmarked same-name `mcp_servers.dsh-delegate` entry | `conflict` (`unmanaged-entry`); byte-identical after install/repair/remove |
|
|
1079
|
-
| an unmarked entry that is EXACTLY the owned entry (same command, single script argument, timeout and env) in one unambiguous standard table | `conflict` (`unmanaged-entry-exact`); byte-identical after install/remove, and `repair` adds the one marker line |
|
|
1080
|
-
| an unmarked entry with a duplicated key, an inline table beside the header, or an extra/empty sub-table | `conflict` (`unmanaged-entry`); byte-identical after install/repair/remove |
|
|
1081
|
-
| entry added between the read and the write | re-classified; refused if it stopped being ours |
|
|
1082
|
-
| package `bin/dsh-delegate-mcp.js` missing | MCP refused (`MCP_SCRIPT_MISSING`), agent still installed |
|
|
1083
|
-
| plain Node.js host (`process.execPath` is a Node binary) | `command` is that path; no override is consulted |
|
|
1084
|
-
| DSH Desktop host (`process.versions.electron` set) | `command` is the bundled runtime, **never** `DeepSeek Harness.exe` |
|
|
1085
|
-
| desktop host that exposes no `resourcesPath` | `<dirname(execPath)>/resources` is derived and the bundled runtime is used |
|
|
1086
|
-
| bundled runtime missing, `DSH_NODE_PATH` set to an absolute existing file | that file is written as `command` |
|
|
1087
|
-
| an override that is relative / a directory / a link / missing | ignored; the next candidate is tried, and the reason is kept in `nodeError.details.rejected` |
|
|
1088
|
-
| no candidate can be proved | status: `mcp.node = null`, `nodeResolved: false`, `ready: false`; install/repair refuse `MCP_EXECUTABLE_UNRESOLVED`; `config.toml` byte-identical; agent file still installed |
|
|
1089
|
-
| no candidate can be proved, an owned entry already points at a stale command | left as written (nothing is guessed); the note names the environment variable to set |
|
|
1090
|
-
| DSH has no execution plane (public bind) | unchanged by this feature; delegation still refuses |
|
|
1091
|
-
| the agent is asked to dispatch into a dirty repository | `delegate_preflight` answers `block` / `PREFLIGHT_DIRTY_NEEDS_DECISION`; the coordinator evaluates the listed paths and task, then either reports and dispatches with an isolation-only `shared` override or pauses when risk/ownership is unclear |
|
|
1092
|
-
| the agent is asked to dispatch into a non-repository or commit-less directory | `block` with the matching `PREFLIGHT_*` code; the agent stops and reports it rather than submitting |
|
|
1093
|
-
| the workspace path is relative, missing or a file | `block` / `PREFLIGHT_WORKSPACE_INVALID` or `PREFLIGHT_NOT_A_DIRECTORY`; nothing is resolved against the process cwd |
|
|
1094
|
-
| `delegate_preflight` is called while the switch is off | answered normally: it authorizes nothing, and that is when a coordinator needs it most |
|
|
1095
|
-
| `delegate_preflight` is sent `allowShared: "true"` | `MCP_ARGUMENT_TYPE`; the plane is not called |
|
|
1096
|
-
| `delegate_submit` is called twice for one directory | two Sessions in one Workspace: a new submission never continues a previous one |
|
|
1097
|
-
| `delegate_submit` sends `continueFromTaskId` for an unknown, pruned or live parent | the run fails with `JOB_CONTINUATION_REFUSED` and `error.details.session` = `SESSION_CONTINUATION_UNKNOWN` / `SESSION_CONTINUATION_STATE`; no conversation is started |
|
|
1098
|
-
| a follow-up names a parent that ran elsewhere (another directory, another worktree, another repository) | `JOB_CONTINUATION_REFUSED` with `SESSION_CONTINUATION_PATH_MISMATCH` / `SESSION_CONTINUATION_WORKSPACE_MISMATCH`; nothing runs |
|
|
1099
|
-
| a follow-up to a `worktree` task is submitted with the source checkout | accepted: the source path remains the authorization/preflight path, and the engine restores the parent's exact managed tree internally |
|
|
1100
|
-
| a follow-up's recorded tree was removed or belongs to another run | `SESSION_CONTINUATION_UNAVAILABLE` with the stated reason; no fresh tree is prepared |
|
|
1101
|
-
| `continueFromTaskId` is not a string | refused at the MCP schema (`MCP_ARGUMENT_TYPE`) and again by the engine (`JOB_CONTINUATION_REFUSED`) |
|
|
1102
|
-
| the settings page is asked to save a conversation mode | `setConversation` refuses with `CONVERSATION_MODE_REMOVED`; the stored legacy value is untouched and still inert |
|
|
1
|
+
# Codex integration contract
|
|
2
|
+
|
|
3
|
+
Status: implemented in 1.9.2 (retaining the 1.9.0 native skill migration from legacy subagent `agents/dsh-taskbridge.toml` to `skills/dsh-taskbridge/SKILL.md`, with safe automatic retirement of untouched 0.1.6–1.8.x legacy subagents and automatic refresh of untouched 1.9.0 / 1.9.1 skills; Antigravity integration is documented in `docs/antigravity-integration.md`, and Claude Code / Claude Desktop integration is planned for 2.0).
|
|
4
|
+
|
|
5
|
+
The 1.7.0 release also makes future managed upgrades self-recognising: the two exact
|
|
6
|
+
companions this machine really held (`1.6.1` in both terminator spellings and the local
|
|
7
|
+
`1.6.1-test.5` prerelease) are now enumerated, and an explicit install or the startup refresh
|
|
8
|
+
records the LF-normalized digest of the template it wrote, in one small file per real Codex
|
|
9
|
+
home. A LATER release therefore recognises the template the previous one wrote without
|
|
10
|
+
appending another digest by hand, while an edited file — one changed character, or only the
|
|
11
|
+
`version` line — still stays the operator's and is never rewritten. See section 5.
|
|
12
|
+
|
|
13
|
+
1.5.1 refreshes the manifest on each activation, resolves a normal linked home root, and upgrades exact shipped/candidate templates while preserving custom content. See [1.5.1 notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.5.1.zh.md).
|
|
14
|
+
|
|
15
|
+
1.5.0 adds `delegate_question_answer`, combined decision/answer-and-wait flows and program metrics. Managed upgrades recognize the exact published 1.4.2 and verified local test.1/test.2 companions; customized files remain operator-owned. See the [1.5.0 release notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.5.0.zh.md).
|
|
16
|
+
|
|
17
|
+
1.4.2 also recognizes the exact published 1.4.1 companion for managed upgrades.
|
|
18
|
+
The review behavior introduced in 1.4.1 recognizes the exact unmodified
|
|
19
|
+
1.4.0 companion in LF and CRLF forms, and updates the review contract: a completed
|
|
20
|
+
task may be read and reviewed by its original identity after a restart. History
|
|
21
|
+
does not restore execution or old permissions. Reviews are confirmed only when
|
|
22
|
+
`reviewPersistence.durable` is true (`state: "saved"`); `saving` or `timed-out`
|
|
23
|
+
means the write is still unconfirmed, and `failed` permits a retry. Ordinary waits
|
|
24
|
+
omit review prose. A result that reports `noteOmitted: true` can be read with
|
|
25
|
+
`delegate_result` plus `reviewNoteOffset` and optional `reviewNoteLimit` (1–2000
|
|
26
|
+
Unicode code points per page, default 2000); follow `nextOffset` until `complete`.
|
|
27
|
+
Review notes accept up to 8000 code points after trimming and are stored redacted.
|
|
28
|
+
See the [release notes](https://github.com/ranranyya/dsh-taskbridge/blob/master/docs/releases/1.4.1.zh.md) for validation boundaries.
|
|
29
|
+
|
|
30
|
+
This document is the contract between the plugin's settings page (browser half),
|
|
31
|
+
the host-side installer (`src/codex/installer.js`) and the skill files and MCP entry it manages.
|
|
32
|
+
It is written so a reviewer can check the code against it without reading the
|
|
33
|
+
README.
|
|
34
|
+
|
|
35
|
+
## Native Codex Skill migration (1.9.0)
|
|
36
|
+
|
|
37
|
+
Starting in `1.9.0`, the managed Codex target is the native skill
|
|
38
|
+
`$CODEX_HOME/skills/dsh-taskbridge/SKILL.md` (with independent ownership digests in
|
|
39
|
+
`codex-skill-ownership`). Installing a native skill instead of a subagent allows the active
|
|
40
|
+
Codex session to read the workflow directly and drive one `delegate_submit` +
|
|
41
|
+
`delegate_wait` chain (using `tool_timeout_sec = 3660`) instead of wrapping dispatch in
|
|
42
|
+
`spawn_agent` + short-timeout `wait_agent` polling loops.
|
|
43
|
+
|
|
44
|
+
The generated entry carries the ordinary flow and links a same-directory rules reference for
|
|
45
|
+
multi-stage planning and uncommon events. Installation publishes the reference before switching
|
|
46
|
+
`SKILL.md`. Older references remain available to Codex sessions that already loaded a previous
|
|
47
|
+
entry. Startup restores a missing reference for an unchanged entry. An edited reference makes
|
|
48
|
+
both files operator-managed. Uninstall removes the unchanged active pair after proving ownership.
|
|
49
|
+
|
|
50
|
+
An explicit `install`, startup refresh, or `remove` inspects `$CODEX_HOME/agents/dsh-taskbridge.toml`
|
|
51
|
+
and `$CODEX_HOME/agents/dsh-delegate.toml` against both `KNOWN_AGENT_TEMPLATES` (`0.1.6`–`1.8.x`)
|
|
52
|
+
and historical `codex-agent-ownership` records. Untouched legacy managed subagent files are
|
|
53
|
+
unlinked ONLY after re-proving their exact bytes (and, on install/refresh, after confirming
|
|
54
|
+
`skills/dsh-taskbridge/SKILL.md` is ready). Any user-modified legacy file is preserved untouched
|
|
55
|
+
and surfaced via `LEGACY_AGENT_USER_MODIFIED`. Boundary checks cover `$CODEX_HOME`, `skills/`,
|
|
56
|
+
`skills/dsh-taskbridge/`, and `agents/`.
|
|
57
|
+
|
|
58
|
+
The action result's `changed` array reports `agent` for a write or removal of
|
|
59
|
+
`SKILL.md`, `legacyAgent` for removal of one or more managed legacy TOML files,
|
|
60
|
+
and `mcp` for a change to the MCP entry. An install that writes the skill and
|
|
61
|
+
retires a legacy file includes both `agent` and `legacyAgent`.
|
|
62
|
+
|
|
63
|
+
## TaskBridge companion migration (1.3.2)
|
|
64
|
+
|
|
65
|
+
The public companion is now `dsh-taskbridge`, installed as
|
|
66
|
+
`agents/dsh-taskbridge.toml`. An explicit install or the startup refresh migrates
|
|
67
|
+
an unchanged, recognized published `agents/dsh-delegate.toml` and removes the old
|
|
68
|
+
managed file after the new managed template is present. Edited files and an
|
|
69
|
+
operator-owned destination remain untouched; startup does not perform a first
|
|
70
|
+
installation when no previous managed companion exists. The MCP table remains
|
|
71
|
+
`mcp_servers.dsh-delegate`, and `delegate_*` tool names remain compatible.
|
|
72
|
+
|
|
73
|
+
1.4.0 recognizes the exact published 1.3.2 companion and refreshes its waiting rules
|
|
74
|
+
on plugin startup. After examining a delivered result, the companion records its own
|
|
75
|
+
accepted or changes-requested conclusion with `delegate_review`; the plugin never
|
|
76
|
+
derives acceptance from completion. A client may need reloading to see the refreshed
|
|
77
|
+
agent and tool catalog. Edited companion files remain operator-owned.
|
|
78
|
+
|
|
79
|
+
Explicit install/repair can also adopt a marked standard legacy MCP path after
|
|
80
|
+
the old `dsh-delegate` or `dsh-taskdispatch` package has been uninstalled from the
|
|
81
|
+
same `node_modules` as the current `dsh-taskbridge`. This narrow exception does
|
|
82
|
+
not apply to custom wrappers, other directories, or automatic startup refresh.
|
|
83
|
+
`repair` remains MCP-only. TaskBridge CLI aliases point at the existing bin files.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Explicit task descriptions (1.5.4)
|
|
88
|
+
|
|
89
|
+
`delegate_submit` and `POST /tasks` accept optional `goalDescription`; `delegate_review` and `POST /tasks/review` accept optional `completionSummary`. Both trim surrounding whitespace, preserve internal newlines, and allow at most 2000 Unicode code points before and after redaction. Missing or blank strings are absent; explicit null and other non-strings are refused. No value is inferred from prompts or earlier tasks.
|
|
90
|
+
|
|
91
|
+
The goal is fixed at task creation. The completion summary exists only under `hostAcceptance.completionSummary`, is part of the review identity with decision and note, and becomes public only after the same review write is durable. A saved review cannot gain or change a summary. Compact waits return only its character count and an omission flag; full results contain the prose. History retains titles and explicit continuation references without inventing missing old data.
|
|
92
|
+
|
|
93
|
+
## 1. What is owned, and what is not
|
|
94
|
+
|
|
95
|
+
| Path | Owner | The plugin may | The plugin may never |
|
|
96
|
+
| --- | --- | --- | --- |
|
|
97
|
+
| `$CODEX_HOME/skills/dsh-taskbridge/SKILL.md` | managed copy of `codex/skills/dsh-taskbridge/SKILL.md` | create it **exclusively** on explicit install (or legacy migration) when absent; refresh a byte-exact known build during plugin startup or explicit install; delete it on `remove` only after re-reading it and finding the same bytes it classified (and unlink untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml` after re-proving their bytes) | overwrite or delete a file that is not that exact build — including a skill or legacy agent file whose body was edited, and including a file that changed in the window between the status read and the write/removal |
|
|
98
|
+
| `$CODEX_HOME/config.toml`, table `mcp_servers.dsh-delegate` | operator, with one managed entry | add the entry when absent; update `command`/`args`/its own `env.DSH_DELEGATE_DISCOVERY_FILE` when the entry carries **the plugin marker** *and* is the exact shape this plugin writes; on an explicit `install`/`repair` only, adopt a recorded `args[0]` that is a PROVED real installation of this package (manifest `name` + `bin["dsh-delegate-mcp"]` mapping) | touch any other key, table, comment or ordering; adopt, update or delete an unmarked same-name entry, even one whose values coincide; adopt a differing script path from the automatic startup check |
|
|
99
|
+
| `$CODEX_HOME`, `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge` and `$CODEX_HOME/agents` | Codex | resolve and pin a normal root symlink/junction to its real directory; inspect all 4 boundary levels in one batched Windows check; create missing `skills/dsh-taskbridge` (`0700`) on explicit install | retarget or delete the root alias; follow a link in `skills/`, `skills/dsh-taskbridge/`, `agents/` or the final file; write through an unusable or unverified target |
|
|
100
|
+
| DSH local-call switch | operator | report it | change it |
|
|
101
|
+
|
|
102
|
+
`$CODEX_HOME` resolution: `CODEX_HOME` when set and absolute; otherwise
|
|
103
|
+
`~/.codex`. A relative override is refused (`CODEX_HOME_INVALID`), because
|
|
104
|
+
resolving it against the harness's cwd would report on, and write to, a directory
|
|
105
|
+
nobody named.
|
|
106
|
+
|
|
107
|
+
### 1.1 Link boundaries
|
|
108
|
+
|
|
109
|
+
`lstat` on the final file is not enough: if `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge`, or `$CODEX_HOME/agents` is a junction,
|
|
110
|
+
`mkdir -p` and the file create would walk *through* it and write outside the Codex home entirely. Since 1.5.1 the selected HOME root is first pinned to its real directory; since 1.9.0 that real root plus `skills/`, `skills/dsh-taskbridge/` and `agents/` are inspected together as boundaries:
|
|
111
|
+
|
|
112
|
+
| `$CODEX_HOME` | `skills/` · `skills/dsh-taskbridge/` · `agents/` | result |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| real directory | missing | normal: explicit `install` creates `skills/dsh-taskbridge` (`0700`) |
|
|
115
|
+
| real directory | real directory | normal |
|
|
116
|
+
| real directory | link (symlink or junction) | `agent.state = conflict`, `reason = skills-dir-is-link` / `skill-dir-is-link` / `agents-dir-is-link`; install/repair/remove all refuse with `AGENT_PATH_CONFLICT` |
|
|
117
|
+
| root symlink/junction with a real directory target | checked under the pinned real target | normal root alias; alias preserved, subdirectory/file links still refused |
|
|
118
|
+
| could not be verified | — | `agent.state = conflict`, `reason = boundary-unverified`; same refusal |
|
|
119
|
+
|
|
120
|
+
A **junction** is the case `lstat` cannot see: Windows reports it as an ordinary
|
|
121
|
+
directory. On Windows the `ReparsePoint` file attribute is read through one
|
|
122
|
+
`powershell.exe` child (`-NoProfile -NonInteractive`, hidden, 15 s bound), with the
|
|
123
|
+
paths passed in an environment variable rather than interpolated into script text.
|
|
124
|
+
The child answers one comma-separated verdict per path — `dir/<bool>`, `other/<bool>`
|
|
125
|
+
or `missing` — and the boolean is PowerShell's `Boolean.ToString()` output, whose
|
|
126
|
+
spelling is **not** stable (`True`/`False` on Windows PowerShell 5.1, `true`/`false`
|
|
127
|
+
under other hosts/cultures). The verdict is therefore parsed case-insensitively
|
|
128
|
+
(`parseDirectoryVerdict`), the script emits lower case via `ToLowerInvariant()`, and
|
|
129
|
+
anything that is not a recognised `dir/`/`other/`/`missing` answer is treated as
|
|
130
|
+
`other` (a path this plugin will not write under), never as a missing answer.
|
|
131
|
+
A regular directory — `dir/false` in any spelling — is `directory`, so the ordinary
|
|
132
|
+
Windows layout is unaffected; only `dir/true` / `other/true` are reported as a link.
|
|
133
|
+
This is pinned by a real-directory probe test that runs the actual PowerShell child on
|
|
134
|
+
a temporary directory on Windows (and skips elsewhere), not only through the test
|
|
135
|
+
classifier hook.
|
|
136
|
+
|
|
137
|
+
The status document reports this as `boundary: { blocked, link, unknown, home,
|
|
138
|
+
skills, skillDir, agents }`. A **failed** verification is a refusal, not a pass: if the platform
|
|
139
|
+
answer cannot be obtained (no spawnable shell, no PowerShell), the boundary is
|
|
140
|
+
`unknown` and every action refuses, because "could not check" must never be read
|
|
141
|
+
as "safe". The check is re-done at the start of every writing action from the
|
|
142
|
+
freshly read status, so a link that replaced either directory after the operator
|
|
143
|
+
last looked is still refused.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 2. The MCP entry
|
|
149
|
+
|
|
150
|
+
The owned shape, written as a marked block:
|
|
151
|
+
|
|
152
|
+
```toml
|
|
153
|
+
# dsh-delegate: managed by the DSH Delegate plugin settings page
|
|
154
|
+
[mcp_servers.dsh-delegate]
|
|
155
|
+
command = "<a Node.js executable, resolved as described in 2.1>"
|
|
156
|
+
args = ["<installed package>/bin/dsh-delegate-mcp.js"]
|
|
157
|
+
tool_timeout_sec = 3660
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
* `command` is an **absolute path to a Node.js executable**, never a bare `node` and
|
|
161
|
+
never the desktop application. A GUI-launched Codex often has a narrower `PATH`
|
|
162
|
+
than the shell that started DSH, so a bare `node` fails at spawn time; and in the
|
|
163
|
+
DSH Desktop (Electron) host `process.execPath` is `DeepSeek Harness.exe`, which
|
|
164
|
+
would make Codex launch a second GUI instead of an MCP server. Section 2.1 states
|
|
165
|
+
how the executable is chosen and what happens when no candidate can be proved.
|
|
166
|
+
* `args[0]` is derived from `import.meta.url` of the running module, so it names
|
|
167
|
+
the *installed* package — never a repository checkout and never a path captured
|
|
168
|
+
when the tarball was built.
|
|
169
|
+
* `tool_timeout_sec = 3660` (1.1.0) is an **owned scalar on this entry only**. The
|
|
170
|
+
`delegate_wait` tool defaults to a 3600-second wait and caps it there, so a client that
|
|
171
|
+
honours this field is allowed to let one call run that long. The plugin cannot prove that
|
|
172
|
+
every client honours it: a client that applies its own tool timeout may still end the
|
|
173
|
+
wait earlier. That is an OUTER limit and is not a `wait-limit` answer. The managed entry
|
|
174
|
+
therefore *requests* 3660 s — the 3600-second wait plus one minute of slack, never a
|
|
175
|
+
second wait window — while a client-side cap that ignores the field remains a client
|
|
176
|
+
limit the plugin cannot lift. This is not a Codex-wide setting and the plugin writes it
|
|
177
|
+
nowhere else.
|
|
178
|
+
* When a client exposes a yield/pragmas parameter, an ordinary wait should request
|
|
179
|
+
roughly `1200000` ms (20 minutes), not one minute. A one-minute return is a caller
|
|
180
|
+
choice, not a documented hard maximum, and not every client supports the same long
|
|
181
|
+
yield — the agent is told to state what its client actually offers rather than
|
|
182
|
+
describe one minute as inherent.
|
|
183
|
+
* A managed entry written by an earlier release has no such field. It is classified
|
|
184
|
+
`outdated` and repaired **in place** (the line is inserted inside our table), so an
|
|
185
|
+
existing installation updates through the settings page instead of being reported as
|
|
186
|
+
somebody else's file.
|
|
187
|
+
* A managed entry with a different integer is likewise `outdated` and rewritten to
|
|
188
|
+
3660. A non-integer value is not a value this plugin writes, so the whole entry is
|
|
189
|
+
treated as operator-owned and left untouched (`timeout-not-an-integer`).
|
|
190
|
+
* An unmarked same-name entry stays a conflict regardless of its values: the marker
|
|
191
|
+
comment is the only authorship proof this format carries.
|
|
192
|
+
* `env.DSH_DELEGATE_DISCOVERY_FILE` is written only when DSH uses a non-default
|
|
193
|
+
discovery location (`DSH_HOME` set, or `DSH_DELEGATE_DISCOVERY_FILE` set). The
|
|
194
|
+
default stays implicit so a later `DSH_HOME` change is not silently overridden.
|
|
195
|
+
|
|
196
|
+
### 2.1 The `command` executable (`resolveNodeExecutable`)
|
|
197
|
+
|
|
198
|
+
The host is classified first (`hostRuntimeKind`): `process.versions.electron` makes
|
|
199
|
+
it an **electron** host; `process.resourcesPath` (set by Electron and by nothing in
|
|
200
|
+
plain Node.js) is an equivalent desktop signal; otherwise it is a **node** host.
|
|
201
|
+
|
|
202
|
+
| host | `process.execPath` | selected `command` |
|
|
203
|
+
| --- | --- | --- |
|
|
204
|
+
| plain Node.js | `node`/`node.exe` | that path, unchanged — it is the runtime that loaded this plugin |
|
|
205
|
+
| plain Node.js, `execPath` is not a Node binary | an embedded host binary | falls through to the desktop rules below, never `execPath` |
|
|
206
|
+
| DSH Desktop (Electron) | `DeepSeek Harness.exe` | the DSH **bundled runtime**, below |
|
|
207
|
+
|
|
208
|
+
The bundled runtime is
|
|
209
|
+
`<resources>/runtime/primary-runtime/dependencies/node/bin/node.exe` on Windows and
|
|
210
|
+
`…/bin/node` elsewhere (`packagedNodePath`). `<resources>` is `process.resourcesPath`
|
|
211
|
+
when the host exposes it; otherwise it is derived from the application executable as
|
|
212
|
+
`<dirname(execPath)>/resources` — the layout DSH Desktop installs into
|
|
213
|
+
(`…\DeepSeek Harness\resources\…` beside `…\DeepSeek Harness\DeepSeek Harness.exe`).
|
|
214
|
+
|
|
215
|
+
If the bundled runtime is not there, these environment variables are consulted **in
|
|
216
|
+
this order**, and the first usable one wins:
|
|
217
|
+
|
|
218
|
+
| variable | accepted when |
|
|
219
|
+
| --- | --- |
|
|
220
|
+
| `DSH_NODE_PATH` | an absolute path |
|
|
221
|
+
| `DSH_NODE_EXECUTABLE` | an absolute path |
|
|
222
|
+
| `CODEX_MCP_NODE_PATH` | an absolute path |
|
|
223
|
+
|
|
224
|
+
"Usable" is strict: the value must be **absolute**, its basename must be a Node
|
|
225
|
+
binary (`node`, `node.exe`, or a versioned `node-*.exe`), and `lstat` must report an
|
|
226
|
+
existing **regular file**. A relative path, a directory, a link and a missing file
|
|
227
|
+
are each rejected with a reason, and their rejection does not stop the next
|
|
228
|
+
candidate from being tried.
|
|
229
|
+
|
|
230
|
+
**Fail closed.** When no candidate is usable, `resolveNodeExecutable` throws
|
|
231
|
+
`CodexInstallError('MCP_EXECUTABLE_UNRESOLVED')`. The desktop application executable
|
|
232
|
+
and a bare `node` are never substituted. The status document reports this instead of
|
|
233
|
+
throwing: `mcp.node = null`, `mcp.nodeResolved = false`, `mcp.nodeError = { code,
|
|
234
|
+
message, details }`, `mcp.state = unreadable` (`reason: no-executable`), `ready =
|
|
235
|
+
false`, plus an `MCP_EXECUTABLE_UNRESOLVED` note. `install` and `repair` refuse the
|
|
236
|
+
MCP target with `MCP_EXECUTABLE_UNRESOLVED` and leave `config.toml` byte-identical;
|
|
237
|
+
the agent file is an independent target and is still installed.
|
|
238
|
+
|
|
239
|
+
### 2.1 Classification
|
|
240
|
+
|
|
241
|
+
`classifyMcpEntry` locates the definition (block or inline), then decides:
|
|
242
|
+
|
|
243
|
+
| state | meaning | install |
|
|
244
|
+
| --- | --- | --- |
|
|
245
|
+
| `not-configured` | no `mcp_servers.dsh-delegate` at all | writes the block |
|
|
246
|
+
| `configured` | the marker is present **and** the values are exactly the owned shape | no change |
|
|
247
|
+
| `outdated` | marked owned command, but stale `args`/discovery/`tool_timeout_sec`; or the narrowly recognised 0.1.6 Desktop command with the current package `args` and owned env shape | rewrites only those values in place |
|
|
248
|
+
| `conflict` | anything else (`unmanaged-entry`, `unmanaged-entry-exact`, `command-not-ours`, `legacy-command-shape`, `url`, `unknown-field`, `extra-env`, `args-not-an-array`, `command-not-a-string`, `not-a-table`, `array-table`, and the boundary reasons below) | **refuses** with `MCP_ENTRY_CONFLICT` and a note explaining why; `repair` adds the marker for `unmanaged-entry-exact` only |
|
|
249
|
+
|
|
250
|
+
Every classification also reports **`drift`**: the list of owned facts that are stale
|
|
251
|
+
(`tool_timeout_sec`, `args`, `command`, `env`), or `null` when nothing is. The status
|
|
252
|
+
document publishes it as `mcp.drift`, and the note for an `outdated` entry names each
|
|
253
|
+
one, so neither the page nor a log line has to infer what a repair would change.
|
|
254
|
+
|
|
255
|
+
An `args[0]` that names `dsh-delegate-mcp.js` somewhere ELSE is a `conflict`
|
|
256
|
+
(`args-shape-not-ours`) in a bare status read: the synchronous classifier cannot prove that
|
|
257
|
+
a different path is this package, so it never labels one `outdated`. Only an explicit
|
|
258
|
+
`install`/`repair` may adopt it, after the asynchronous proof below — and only with the
|
|
259
|
+
config digest, the `$CODEX_HOME`/`skills`/`skills/dsh-taskbridge`/`agents` boundary and the current entry re-checked
|
|
260
|
+
immediately before the write. A different script name, a different command or an extra
|
|
261
|
+
argument stays `conflict` everywhere.
|
|
262
|
+
|
|
263
|
+
When `$CODEX_HOME`, `$CODEX_HOME/skills`, `$CODEX_HOME/skills/dsh-taskbridge` or `$CODEX_HOME/agents` is a link (or cannot be verified), the MCP
|
|
264
|
+
target is reported as `conflict` with `reason` `codex-home-is-link`, `skills-dir-is-link`, `skill-dir-is-link`,
|
|
265
|
+
`agents-dir-is-link` or `boundary-unverified` — the same verdict the skill target gets.
|
|
266
|
+
The entry is **not** read through the link, because a link bounds every write this
|
|
267
|
+
module makes, not only the skill file.
|
|
268
|
+
|
|
269
|
+
Two rules are deliberate:
|
|
270
|
+
|
|
271
|
+
* **`unmanaged-entry`.** Values alone never establish ownership. An entry without
|
|
272
|
+
the marker comment — even one whose `command`/`args` are byte-identical to what
|
|
273
|
+
the plugin would write — is the operator's. It is reported as a conflict, and
|
|
274
|
+
`install`, `repair` and `remove` all leave it byte-identical. The marker must be
|
|
275
|
+
the comment line directly above the definition (or above the `[mcp_servers]`
|
|
276
|
+
header when the definition is the inline `dsh-delegate = { … }` spelling); a
|
|
277
|
+
marker elsewhere in the file does not count.
|
|
278
|
+
* **`unmanaged-entry-exact`.** The same unmarked definition, but it already IS this
|
|
279
|
+
build's entry in every owned fact: `command` is the resolved Node executable, `args` is
|
|
280
|
+
exactly this installation's entry script, `tool_timeout_sec` is the owned integer, and
|
|
281
|
+
the `env` map is exactly the owned one (no additional key, none missing) — and the
|
|
282
|
+
definition is ONE unambiguous standard `[mcp_servers.dsh-delegate]` table with unique
|
|
283
|
+
keys. This is the configuration the settings page shows, entered by hand without the marker
|
|
284
|
+
comment. It stays a `conflict` for `status`, plugin startup and `remove`, but the reason
|
|
285
|
+
names it so that “仅修复 MCP 配置” (`repair`) may make ONE edit: insert the marker line
|
|
286
|
+
directly above the server's OWN header and change no other byte.
|
|
287
|
+
The write re-reads `config.toml`, requires the plan's digest, the boundary verdict, the
|
|
288
|
+
whole owned shape and this installation's exact script to still hold, and splices the
|
|
289
|
+
marker into the original text at the header line's character offset — so a BOM, mixed
|
|
290
|
+
CRLF/LF endings, an indented header, an operator comment above it and a missing final
|
|
291
|
+
newline all survive, and deleting the new line restores the file byte for byte. It then
|
|
292
|
+
verifies the marker is adjacent to the server's own header (never to a shared
|
|
293
|
+
`[mcp_servers]` parent, which would claim sibling entries), that the result classifies as
|
|
294
|
+
`configured`, and that the change is exactly that one line.
|
|
295
|
+
Refused, with the plain `unmanaged-entry` reason and a byte-identical file: any owned value
|
|
296
|
+
that differs; a duplicated key (the parser keeps every entry, so a merge would let the last
|
|
297
|
+
value win); an inline table beside or instead of the header; an extra or empty sub-table
|
|
298
|
+
such as `[mcp_servers.dsh-delegate.custom]`; a nested inline table value; an array table.
|
|
299
|
+
`install` never adds the marker.
|
|
300
|
+
* **`command-not-ours`.** A different command is a different program, so even
|
|
301
|
+
identical arguments do not make the entry ours. `extra-env` is symmetrical — an
|
|
302
|
+
`env` key the plugin did not write is the operator's data, and an entry carrying
|
|
303
|
+
one is reported as a conflict rather than pruned.
|
|
304
|
+
|
|
305
|
+
* **0.1.6 Desktop migration.** Version 0.1.6 could write the DSH Desktop GUI as
|
|
306
|
+
`command`. A marked entry is eligible for one automatic migration only when its
|
|
307
|
+
command has a path whose case-insensitive basename is exactly `DeepSeek Harness.exe`,
|
|
308
|
+
its `args` already name this installed package's `bin/dsh-delegate-mcp.js`, and its
|
|
309
|
+
env keys and values exactly match the currently owned shape. The installer then
|
|
310
|
+
reports `outdated` and replaces only the command with the proven Node runtime.
|
|
311
|
+
A bare GUI name, a similarly named executable, stale args, extra env or any other
|
|
312
|
+
command remains `conflict` and is left byte-identical.
|
|
313
|
+
|
|
314
|
+
### 2.2 Merge mechanics
|
|
315
|
+
|
|
316
|
+
`src/codex/toml.js` locates structure by line and column ranges and edits only
|
|
317
|
+
those ranges. It is a locator, not a validating TOML implementation, and it
|
|
318
|
+
refuses (`TomlSyntaxError`, carrying a line number) rather than guess:
|
|
319
|
+
|
|
320
|
+
* an unterminated single-line string, array or inline table;
|
|
321
|
+
* a table header with trailing text;
|
|
322
|
+
* a raw control character (0x00–0x08, 0x0A–0x1F except tab) **anywhere other than
|
|
323
|
+
as a line ending** — see below;
|
|
324
|
+
* text after a table header, an unbalanced bracket, a key without `=`.
|
|
325
|
+
|
|
326
|
+
**CRLF.** A Codex config touched by a Windows editor is normally CRLF. The locator
|
|
327
|
+
splits on `\n` only, treats a *terminal* `\r` as the second byte of a line ending
|
|
328
|
+
(it is skipped wherever whitespace would end a token), and every mutation re-joins
|
|
329
|
+
with the document's detected ending. Installing, updating and removing an entry in
|
|
330
|
+
a CRLF file therefore preserves CRLF and leaves every unrelated byte — comments,
|
|
331
|
+
settings, table order — exactly as it was. A `\r` **inside** a line (a broken or
|
|
332
|
+
mixed-ending file) is still a control character and still refuses the document as
|
|
333
|
+
a whole.
|
|
334
|
+
|
|
335
|
+
A refusal makes the whole action refuse (`CODEX_CONFIG_UNSUPPORTED`) and leaves
|
|
336
|
+
the file byte-identical. Nothing is ever written with a parsed-then-serialized
|
|
337
|
+
round trip, so comments and ordering cannot be lost.
|
|
338
|
+
|
|
339
|
+
Writes land through `writeFileAtomic` (temp file + rename), so a crash leaves the
|
|
340
|
+
previous or the new full document, never a partial one. A *first* agent file is
|
|
341
|
+
created with `link`, which fails when the target exists: a file that appears
|
|
342
|
+
between the status read and the write is reported (`AGENT_PATH_CONFLICT`,
|
|
343
|
+
`created-concurrently`) instead of being replaced.
|
|
344
|
+
|
|
345
|
+
### 2.3 Removal
|
|
346
|
+
|
|
347
|
+
`remove` deletes the `mcp_servers.dsh-delegate` table (header, assignments, child
|
|
348
|
+
tables and the plugin marker line) and the agent file when — and only when — that
|
|
349
|
+
file is the managed template or a byte-exact known prior build. Comments the
|
|
350
|
+
operator wrote *above* the marker stay; the marker itself is the plugin's line.
|
|
351
|
+
A `conflict` or `modified` target is reported and left untouched, including an
|
|
352
|
+
unmarked same-name entry. Removing twice is a no-op.
|
|
353
|
+
|
|
354
|
+
**The agent file is re-proved immediately before it is unlinked.** The status read
|
|
355
|
+
is stale by the time a removal runs: the operator, an editor or another tool may
|
|
356
|
+
have rewritten the file after the verdict. Deleting on the strength of that verdict
|
|
357
|
+
would destroy the new content, so `removeManagedAgentFile` reads the file again and
|
|
358
|
+
requires all of:
|
|
359
|
+
|
|
360
|
+
* it is still a **regular file** (not a link, not a directory) — otherwise
|
|
361
|
+
`AGENT_PATH_CONFLICT` (`reason: not-a-regular-file`);
|
|
362
|
+
* it still exists — otherwise `AGENT_PATH_CONFLICT`
|
|
363
|
+
(`reason: missing-before-removal`), reported as "no change", never as a deletion;
|
|
364
|
+
* its bytes are **exactly** the content the status derived its verdict from
|
|
365
|
+
(`agent.expect`) — otherwise `AGENT_USER_MODIFIED`
|
|
366
|
+
(`reason: modified-before-removal`) and the file is kept.
|
|
367
|
+
|
|
368
|
+
Only then is `unlink` called. A file that *looks* managed but differs by one
|
|
369
|
+
character is therefore refused, and an unlink the filesystem refuses (`EPERM`,
|
|
370
|
+
`EACCES`, `EBUSY`) is reported as `AGENT_PATH_CONFLICT` (`reason: unlink-refused`)
|
|
371
|
+
rather than thrown at the operator.
|
|
372
|
+
|
|
373
|
+
### 2.4 The startup upgrade of an installed integration (1.2.0)
|
|
374
|
+
|
|
375
|
+
`refreshKnownAgentTemplate({ refreshMcp: true })` — reached through the seam as
|
|
376
|
+
`refreshManagedIntegration({ startupTarget, backupDir })` and called once by plugin
|
|
377
|
+
activation — checks the managed skill, legacy subagents and the MCP entry:
|
|
378
|
+
|
|
379
|
+
| target | condition | write |
|
|
380
|
+
| --- | --- | --- |
|
|
381
|
+
| Codex skill | `outdated` (known template or matching ownership record) | replaced with this build's template |
|
|
382
|
+
| Legacy subagents | a `managed-legacy` file still matches the bytes read during inspection | installs the skill if absent, then retires the legacy file once the current or user-edited skill is present |
|
|
383
|
+
| MCP entry | `outdated` **and** passing the write gate below | the owned values rewritten in place, in ONE atomic write |
|
|
384
|
+
|
|
385
|
+
The automatic check only ever accepts THIS installation's exact entry point. The
|
|
386
|
+
moved-install case (a recorded `args[0]` that is a different, provable installation of the
|
|
387
|
+
same package) is described below but is performed only by an explicit `install`/`repair`;
|
|
388
|
+
startup leaves it byte-identical and reports `conflict`.
|
|
389
|
+
|
|
390
|
+
#### The write gate (`isOwnedStaleEntry`)
|
|
391
|
+
|
|
392
|
+
"The classifier said `outdated`" is not permission to write. An automatic, unreviewed
|
|
393
|
+
write additionally requires that the entry is provably this plugin's in EVERY owned fact:
|
|
394
|
+
|
|
395
|
+
| fact | required |
|
|
396
|
+
| --- | --- |
|
|
397
|
+
| marker comment | present (authorship proof) |
|
|
398
|
+
| `command` | exactly this package's Node command (or the narrowed 0.1.6 Desktop command) |
|
|
399
|
+
| `args` length | exactly 1 — no wrapper flags, no extra arguments |
|
|
400
|
+
| `args[0]` | **provably** this package's entry point (see below) |
|
|
401
|
+
| `env` keys | none that this plugin did not write |
|
|
402
|
+
|
|
403
|
+
**`args[0]` must be PROVED, not pattern-matched** (`isOwnedEntryScript`, asynchronous
|
|
404
|
+
because the proof is a filesystem one). There are exactly two accepted proofs:
|
|
405
|
+
|
|
406
|
+
1. **This installation's own file** — an absolute path that is the same location as this
|
|
407
|
+
package's `bin/dsh-delegate-mcp.js`, compared under the PLATFORM's case rules
|
|
408
|
+
(`samePlatformPath`). Linux compares exactly: two case variants are different programs
|
|
409
|
+
there. Windows is case-insensitive; macOS is treated the same way because its default
|
|
410
|
+
volumes are, which is an assumption rather than a promise on a case-sensitive volume. A
|
|
411
|
+
RELATIVE path is never equivalent: `relative/bin/dsh-delegate-mcp.js` names no location.
|
|
412
|
+
2. **A different, real installation of this package** — an absolute path ending in
|
|
413
|
+
`<root>/bin/dsh-delegate-mcp.js` with ALL of:
|
|
414
|
+
* `<root>` and `<root>/bin` are real directories and not links (a junction is caught by
|
|
415
|
+
the same attribute read the boundary check uses);
|
|
416
|
+
* `<root>/bin/dsh-delegate-mcp.js` is a regular, non-link file that IS the candidate
|
|
417
|
+
(compared by `realpath`, so a link cannot smuggle in another program);
|
|
418
|
+
* `<root>/package.json` is a regular, non-link file that declares one of this project's
|
|
419
|
+
own package names (`"dsh-taskbridge"`, `"dsh-taskdispatch"`, or `"dsh-delegate"`),
|
|
420
|
+
carries this project's GitHub repository provenance (`https://github.com/ranranyya/{dsh-taskbridge,dsh-taskdispatch,dsh-delegate}`),
|
|
421
|
+
AND maps `bin["dsh-delegate-mcp"]` to that very entry. A
|
|
422
|
+
`./` prefix is allowed; an absolute path, a `..` segment, a trailing slash, a wrong
|
|
423
|
+
mapping, a missing mapping, a foreign repository or no `bin` object is refused.
|
|
424
|
+
|
|
425
|
+
The `<root>` is derived with the host's `dirname`/`basename` rules (`packageEntryRoot`), so
|
|
426
|
+
a POSIX leading `/` is preserved: splitting on `/` and rejoining would turn
|
|
427
|
+
`/opt/pkg/bin/dsh-delegate-mcp.js` into the relative `opt/pkg/...`, and no real Linux or
|
|
428
|
+
macOS installation could ever be proved.
|
|
429
|
+
|
|
430
|
+
Everything else — a wrapper that reuses the marker, the command or even the file name; a
|
|
431
|
+
same-layout script whose manifest maps its bin elsewhere; a missing path; a link; a
|
|
432
|
+
directory that declares another package — is **not** claimed. The synchronous classifier is
|
|
433
|
+
even stricter: only proof 1 can make an entry `outdated`, so a differing script is always a
|
|
434
|
+
`conflict` (`args-shape-not-ours`) and a bare status read can never authorize a write. Proof
|
|
435
|
+
2 is attempted **only by an explicit `install`/`repair`**, never by the unattended startup
|
|
436
|
+
check, and it is re-run immediately before the write together with the plan's config digest
|
|
437
|
+
and the boundary re-check; an edit in that window is refused (`config-changed`).
|
|
438
|
+
|
|
439
|
+
An unprovable path is therefore KEPT and reported, with a note pointing at the explicit
|
|
440
|
+
button: this is the intended outcome, not a gap. The core upgrade — an exact `args` match
|
|
441
|
+
with only `tool_timeout_sec` missing — always succeeds automatically.
|
|
442
|
+
|
|
443
|
+
#### No concurrent change (`config-changed`)
|
|
444
|
+
|
|
445
|
+
The plan records a SHA-256 of the WHOLE `config.toml` (`mcp.fingerprint`, stripped from the
|
|
446
|
+
public status by `publicCodexStatus`). Immediately before the write the file is re-read and
|
|
447
|
+
the digest must match. Re-classifying alone is not enough: an operator can change an owned
|
|
448
|
+
value and leave an entry that still looks stale and managed, which is exactly the overwrite
|
|
449
|
+
this refuses. The result is `MCP_ENTRY_CONFLICT` with `reason: config-changed` and the file
|
|
450
|
+
is kept byte-identical. This is covered by a deterministic test that changes the file
|
|
451
|
+
between the plan and the write.
|
|
452
|
+
|
|
453
|
+
#### The backup is a PRECONDITION (`MCP_ENTRY_BACKUP_UNAVAILABLE` / `_FAILED`)
|
|
454
|
+
|
|
455
|
+
Before any automatic MCP write the current document is copied to a protected location, and
|
|
456
|
+
that copy is **verified**. It is not best-effort:
|
|
457
|
+
|
|
458
|
+
* no destination supplied → `MCP_ENTRY_BACKUP_UNAVAILABLE`, nothing written; a RELATIVE
|
|
459
|
+
destination is refused as well, because it would be resolved against the harness cwd;
|
|
460
|
+
* EVERY ancestor of the destination is proved to be a real directory — a symbolic link, a
|
|
461
|
+
Windows junction/reparse point, a component the platform cannot verify, or a file in the
|
|
462
|
+
chain refuses the whole backup, so a complete `config.toml` is never written through a
|
|
463
|
+
linked parent (a leaf-only check is not enough: `/safe/backup` can be a plain directory
|
|
464
|
+
below a junction);
|
|
465
|
+
* missing levels are created ONE at a time and each is inspected immediately afterwards; a
|
|
466
|
+
recursive `mkdir` would follow a link that appeared at any depth in the window;
|
|
467
|
+
* the chain is re-checked immediately before the copy is written, then the copy is written
|
|
468
|
+
atomically with owner-only permissions and RE-READ; a mismatch or a write failure →
|
|
469
|
+
`MCP_ENTRY_BACKUP_FAILED`, nothing written;
|
|
470
|
+
* an existing destination that is a link, a non-file, or holds different bytes is refused
|
|
471
|
+
rather than overwritten.
|
|
472
|
+
|
|
473
|
+
The seam supplies `<plugin dataDir>/codex-config-backup` by default, so a caller that passes
|
|
474
|
+
no location still gets one; a direct `refreshMcp` call with no trusted location refuses
|
|
475
|
+
instead of writing. The original file is always left exactly as it was on any refusal.
|
|
476
|
+
|
|
477
|
+
#### The rest of the guarantees
|
|
478
|
+
|
|
479
|
+
* an absent entry stays absent — the plugin never creates `config.toml` or the table at
|
|
480
|
+
startup, so an upgrade can never turn a non-installation into an installation, and the
|
|
481
|
+
same is true of `skills/` when neither the skill nor a recognized legacy companion is present;
|
|
482
|
+
* an unmarked entry, an operator-edited shape and any `conflict` are refused and left
|
|
483
|
+
byte-identical (the outcome carries `MCP_ENTRY_CONFLICT` with the reason);
|
|
484
|
+
* a link or unverifiable directory at `$CODEX_HOME` / `skills` / `skills/dsh-taskbridge` / `agents` is re-inspected immediately
|
|
485
|
+
before the write and produces ONE `AGENT_PATH_CONFLICT` refusal for the whole check, even
|
|
486
|
+
when the visible state shows nothing stale: an upgrade that cannot be proved safe must not
|
|
487
|
+
look successful;
|
|
488
|
+
* the pre-write document is copied to `backupDir` (the plugin data directory) first — never
|
|
489
|
+
into the package, never into the Codex home, and never returned in a response;
|
|
490
|
+
* nothing else in `config.toml` is touched: comments, ordering, other MCP tables, CRLF
|
|
491
|
+
line endings and every unrelated setting survive byte for byte.
|
|
492
|
+
|
|
493
|
+
#### Which home is targeted — ONE precedence for every seam call
|
|
494
|
+
|
|
495
|
+
`resolveHomePreference` is the single implementation, and `status()`, the explicit actions
|
|
496
|
+
and the automatic check all use it. Before that, the check consulted the recorded directory
|
|
497
|
+
while `status()` and the buttons consulted only `CODEX_HOME`/default, so removing
|
|
498
|
+
`CODEX_HOME` made the page report — and the buttons write — a different tree than the one
|
|
499
|
+
startup had just upgraded. The order is:
|
|
500
|
+
|
|
501
|
+
| precedence | target |
|
|
502
|
+
| --- | --- |
|
|
503
|
+
| 1 | an explicit `CODEX_HOME` (or the seam's explicit `codexHome`) |
|
|
504
|
+
| 2 | the home a SUCCESSFUL explicit install recorded in `<dataDir>/codex-installation.json` |
|
|
505
|
+
| 3 | the default (`~/.codex`), only when it exists and is a real directory |
|
|
506
|
+
|
|
507
|
+
A successful `install` records the directory even when it wrote nothing because the
|
|
508
|
+
installation was already exactly right: `changed: []` is a success, not "nothing happened".
|
|
509
|
+
A REFUSED install records nothing, so a refusal cannot become the remembered target.
|
|
510
|
+
|
|
511
|
+
In 1.5.1 the selected home root is pinned by the installer to its real target after this precedence resolution. A normal root symlink/junction is supported; an unresolvable or unverifiable target is refused. A missing home remains `no-codex-home`; a null startup target does not silently fall back to another tree. The root alias is preserved, and links below it in agents or the final files remain forbidden.
|
|
512
|
+
|
|
513
|
+
The explicit 「安装 / 更新 TaskBridge 技能」 button (action `install`) remains
|
|
514
|
+
the way to *create* the managed native skill (`skills/dsh-taskbridge/SKILL.md`) and MCP entry (and safely retire untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml`). `status` reports the drift (`mcp.drift`)
|
|
515
|
+
and, when an entry is `outdated`, a note naming exactly which owned facts are stale.
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## 3. Actions and their guarantees
|
|
520
|
+
|
|
521
|
+
Reachable only through the authenticated user plane (section 4) or the CLI
|
|
522
|
+
`bin/dsh-delegate-codex-agent.js`.
|
|
523
|
+
|
|
524
|
+
| action | writes | never writes |
|
|
525
|
+
| --- | --- | --- |
|
|
526
|
+
| `status` | nothing | anything |
|
|
527
|
+
| `install` | native skill `skills/dsh-taskbridge/SKILL.md` (absent / older managed build) + retires untouched legacy `.toml` subagents + MCP entry (absent / `outdated`) | a user-modified skill or legacy agent file, a conflicting MCP entry, the DSH switch |
|
|
528
|
+
| `repair` | the MCP entry only (absent / `outdated`), exactly as `install` would; plus the marker line for an `unmanaged-entry-exact` definition | the skill or legacy agent files: they are **not created, not refreshed and not deleted**, nor is `skills/` or `agents/` created; no owned value of an unmarked entry is ever rewritten |
|
|
529
|
+
| `remove` | deletes only owned skill, untouched legacy `.toml` files and owned MCP entry | a user-modified skill or legacy agent file, a conflicting entry |
|
|
530
|
+
|
|
531
|
+
`install` is idempotent: a second run with nothing changed reports
|
|
532
|
+
`changed: []` and does not rewrite either file.
|
|
533
|
+
|
|
534
|
+
`install` reports the agent and MCP targets independently. One may succeed while
|
|
535
|
+
the other is refused (for example: no agent file yet, but a conflicting entry), and
|
|
536
|
+
the response says exactly which. The same holds for an unresolvable executable:
|
|
537
|
+
the agent file is still installed, and the MCP half is refused with
|
|
538
|
+
`MCP_EXECUTABLE_UNRESOLVED` (section 2.1).
|
|
539
|
+
|
|
540
|
+
**`repair` is MCP-only.** It is the action behind the settings page's
|
|
541
|
+
「仅修复 MCP 配置」 button and is the same code path `install` uses for its MCP half.
|
|
542
|
+
It never touches the agent file, so with a missing agent it reports
|
|
543
|
+
`agent.state = not-installed` and changes nothing, with an `outdated` agent it leaves
|
|
544
|
+
that file byte-identical (it stays `outdated`), and with a `modified`/`conflict` agent
|
|
545
|
+
it does not even report an agent refusal — the agent is simply out of this action's
|
|
546
|
+
scope. Concretely, `repair`:
|
|
547
|
+
|
|
548
|
+
* returns `changed` containing `mcp` (or nothing) and never `agent`;
|
|
549
|
+
* does not create `$CODEX_HOME/agents` when it is missing;
|
|
550
|
+
* still refuses a `conflict` MCP entry with `MCP_ENTRY_CONFLICT`, exactly like `install`.
|
|
551
|
+
|
|
552
|
+
Updating a stale agent is an explicit `install`, or the byte-exact startup refresh
|
|
553
|
+
described below.
|
|
554
|
+
|
|
555
|
+
**No action runs when the settings page opens, and package install writes nothing.**
|
|
556
|
+
The page's `init()` issues a `GET`; the three buttons are the only callers of the
|
|
557
|
+
`POST`.
|
|
558
|
+
|
|
559
|
+
**The single write at plugin load is the integration refresh.** `apply()` calls the
|
|
560
|
+
seam's `refreshManagedIntegration()` once — only when a Codex home directory exists — which
|
|
561
|
+
refreshes `skills/dsh-taskbridge/SKILL.md` when its complete bytes match a known prior build or recorded digest (and migrates/retires untouched legacy `agents/dsh-taskbridge.toml` / `agents/dsh-delegate.toml` matching `KNOWN_AGENT_TEMPLATES` or `codex-agent-ownership`), **and** upgrades an already installed
|
|
562
|
+
`mcp_servers.dsh-delegate` entry that is provably this plugin's and merely stale
|
|
563
|
+
(section 2.4). It never performs a first-time install when neither the skill nor a recognized legacy companion is present, never creates
|
|
564
|
+
the MCP entry, and never touches a `modified`/`conflict` file: everything else stays an
|
|
565
|
+
explicit `install`. A refusal or failure is logged and startup continues, so a Codex
|
|
566
|
+
problem cannot stop the plugin from loading.
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## 4. Routes
|
|
571
|
+
|
|
572
|
+
One exact path, two methods, registered on `ctx.connection.fetch` (the
|
|
573
|
+
authenticated operator channel):
|
|
574
|
+
|
|
575
|
+
| method | path | body | result |
|
|
576
|
+
| --- | --- | --- | --- |
|
|
577
|
+
| `GET` | `/api/dsh-delegate/codex` | — | `{ ok, action: 'status', changed: [], refused: [], codex, switch }` |
|
|
578
|
+
| `POST` | `/api/dsh-delegate/codex` | `{ "action": "install" \| "repair" \| "remove" }` | `{ ok, action, changed, refused, codex, switch }` |
|
|
579
|
+
|
|
580
|
+
Refusals use the standard envelope and these codes: `CODEX_ACTION_INVALID` (400),
|
|
581
|
+
`CODEX_HOME_INVALID` (400), `CODEX_CONFIG_UNSUPPORTED` (409),
|
|
582
|
+
`CODEX_CONFIG_UNREADABLE` (409), `CODEX_INTEGRATION_UNAVAILABLE` (503). A refusal
|
|
583
|
+
*per target* is not an HTTP error: it appears in `refused[]` with a stable `code`
|
|
584
|
+
(`AGENT_USER_MODIFIED`, `AGENT_PATH_CONFLICT`, `MCP_ENTRY_CONFLICT`,
|
|
585
|
+
`MCP_SCRIPT_MISSING`, `CODEX_CONFIG_UNSUPPORTED`) and the action still answers 200
|
|
586
|
+
with the fresh status, because "I did not touch your file, and here is why" is a
|
|
587
|
+
successful diagnosis.
|
|
588
|
+
|
|
589
|
+
`codex` (status document):
|
|
590
|
+
|
|
591
|
+
```jsonc
|
|
592
|
+
{
|
|
593
|
+
"codexHome": "…",
|
|
594
|
+
"packageVersion": "1.9.2",
|
|
595
|
+
"boundary": {
|
|
596
|
+
"blocked": false, "link": null, "unknown": false,
|
|
597
|
+
"home": "directory", "skills": "directory", "skillDir": "directory", "agents": "directory"
|
|
598
|
+
},
|
|
599
|
+
"skill": {
|
|
600
|
+
"path": "…/skills/dsh-taskbridge/SKILL.md", "state": "installed", "installed": true, "managed": true,
|
|
601
|
+
"reason": null, "expect": "<the exact bytes a refresh may replace>"
|
|
602
|
+
},
|
|
603
|
+
"agent": {
|
|
604
|
+
"path": "…/skills/dsh-taskbridge/SKILL.md", "state": "installed", "installed": true, "managed": true,
|
|
605
|
+
"reason": null, "expect": "<compatibility alias of skill>"
|
|
606
|
+
},
|
|
607
|
+
"legacyAgents": { "state": "absent", "entries": [] },
|
|
608
|
+
"mcp": {
|
|
609
|
+
"path": "…", "exists": true, "serverName": "dsh-delegate",
|
|
610
|
+
"state": "configured", "configured": true,
|
|
611
|
+
"previous": { "command": "…", "args": ["…"], "envKeys": [] },
|
|
612
|
+
"reason": null,
|
|
613
|
+
"marked": true,
|
|
614
|
+
"desired": { "command": "…", "args": ["…"], "env": {} },
|
|
615
|
+
"node": "…", "nodeResolved": true, "nodeError": null,
|
|
616
|
+
"script": "…", "scriptExists": true,
|
|
617
|
+
"discoveryFile": "…", "discoveryPinned": false
|
|
618
|
+
},
|
|
619
|
+
"config": { "readable": true, "error": null },
|
|
620
|
+
"ready": true,
|
|
621
|
+
"notes": [{ "code": "…", "text": "…" }]
|
|
622
|
+
}
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
Agent states: `not-installed`, `installed`, `outdated`, `modified`, `conflict`.
|
|
626
|
+
MCP states: `not-configured`, `configured`, `outdated`, `conflict`, `unreadable`.
|
|
627
|
+
`unreadable` covers both "the config cannot be read safely" and — as of 0.1.7 —
|
|
628
|
+
"no Node.js executable could be proved" (`reason: no-executable`), in which case
|
|
629
|
+
`desired` is `null`, `node` is `null`, `nodeResolved` is `false` and `nodeError`
|
|
630
|
+
carries the `MCP_EXECUTABLE_UNRESOLVED` diagnosis (section 2.1).
|
|
631
|
+
Boundary kinds: `directory`, `missing`, `link`, `other`, `unchecked` (for the level
|
|
632
|
+
below a link, which is deliberately not inspected), and `unknown` when the platform
|
|
633
|
+
answer could not be obtained.
|
|
634
|
+
|
|
635
|
+
`boundary.blocked` is true when any checked boundary directory is a link or could not be verified;
|
|
636
|
+
`boundary.link` names the level (`codex-home`, `skills`, `skillDir` or `agents`) and is `null` otherwise.
|
|
637
|
+
`agent.reason` carries `codex-home-is-link`, `skills-dir-is-link`, `skill-dir-is-link`, `agents-dir-is-link` or
|
|
638
|
+
`boundary-unverified` in that case, so the page can say which boundary it refused.
|
|
639
|
+
|
|
640
|
+
`agent.expect` and `mcp.marked` are the two ownership facts: `expect` is what a
|
|
641
|
+
refresh compares against immediately before its rename, and `marked` is true only
|
|
642
|
+
when the entry carries the plugin marker (i.e. when a `remove` may delete it).
|
|
643
|
+
|
|
644
|
+
`switch` reports the DSH posture and always carries
|
|
645
|
+
`changedByThisAction: false`: no Codex action can authorize dispatch.
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
## 4.1 The preflight tool the skill depends on
|
|
650
|
+
|
|
651
|
+
`delegate_preflight` is a strictly read-only MCP tool that is not an
|
|
652
|
+
authorization at all: it is a read-only measurement of one workspace, added so a
|
|
653
|
+
dispatcher learns *before* submitting that a checkout is dirty, is not a
|
|
654
|
+
repository, or needs an isolation decision — instead of learning it from a job that
|
|
655
|
+
failed after admission.
|
|
656
|
+
|
|
657
|
+
| property | value |
|
|
658
|
+
|---|---|
|
|
659
|
+
| tool | `delegate_preflight` |
|
|
660
|
+
| arguments | `workspacePath` (string, required, absolute), `allowShared` (boolean, optional) |
|
|
661
|
+
| schema | closed: `additionalProperties: false`; `allowShared` must be a real boolean (`MCP_ARGUMENT_TYPE` otherwise, and the plane is never reached) |
|
|
662
|
+
| execution-plane route | `POST /dsh-delegate/x/workspace/preflight` |
|
|
663
|
+
| writes | nothing: no commit, stash, branch, worktree, lock, task, grant or setting |
|
|
664
|
+
| gate | transport fence + connection identity only — **not** the switch, because it authorizes nothing |
|
|
665
|
+
|
|
666
|
+
The answer is `{ ok, readOnly, workspacePath, isolation, reason, sharedExplicit,
|
|
667
|
+
decisionRequired, facts, guidance, checkedAt }` with `isolation` one of
|
|
668
|
+
`worktree` / `shared` / `block` and `reason` a stable `PREFLIGHT_*` code. The full
|
|
669
|
+
shape, the decision table and the four git reads it is allowed to issue are stated
|
|
670
|
+
in `docs/workspace-contract.md` §3.5; this document only records the contract the
|
|
671
|
+
agent file depends on.
|
|
672
|
+
|
|
673
|
+
The one rule a reviewer should check: **a dirty repository is never downgraded
|
|
674
|
+
automatically.** Without `allowShared` the answer is `block` with
|
|
675
|
+
`decisionRequired: true`; with `allowShared: true` — a per-call decision record,
|
|
676
|
+
never a stored preference — it is `shared` with `sharedExplicit: true`. The Codex
|
|
677
|
+
coordinator evaluates the requested task and changed paths and may decide to use
|
|
678
|
+
shared isolation without asking on every dispatch; it pauses when ownership or risk
|
|
679
|
+
is unclear. To make the actual job match that decision, `delegate_submit` passes
|
|
680
|
+
only `{ isolation: "shared" }` as an override. Provider, model, effort and timeout
|
|
681
|
+
remain those selected in the plugin settings.
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## 5. Skill ownership & historical legacy TOML identities
|
|
686
|
+
|
|
687
|
+
From `1.9.0`, the active shipped file is the Markdown skill `$CODEX_HOME/skills/dsh-taskbridge/SKILL.md`
|
|
688
|
+
(with `<!-- dsh-taskbridge-version: 1.9.2 -->` and its content-addressed `rules-reference-<sha256>.md`).
|
|
689
|
+
Earlier `0.1.6`–`1.8.x` releases shipped a custom-agent TOML file:
|
|
690
|
+
|
|
691
|
+
```toml
|
|
692
|
+
version = "1.0.0" # stamped from package.json in 0.1.6–1.8.x legacy builds
|
|
693
|
+
name = "dsh-delegate"
|
|
694
|
+
description = "…"
|
|
695
|
+
developer_instructions = """…"""
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
Neither the active `SKILL.md` nor the historical `.toml` files contain an `[mcp_servers.*]`
|
|
699
|
+
table, because the session/agent uses the parent Codex `config.toml` MCP registration, and a
|
|
700
|
+
second definition would start a second server.
|
|
701
|
+
|
|
702
|
+
**Ownership is content identity, not a heuristic.** `readAgentState` reports:
|
|
703
|
+
|
|
704
|
+
* `installed` — same text (admitting only `\r\n` vs `\n` line-terminator spelling, rejecting lone `\r`) as the `SKILL.md` this build renders, with an intact matching reference file;
|
|
705
|
+
* `outdated` — same text as one of the enumerated `KNOWN_SKILL_TEMPLATES` (`1.9.0` prereleases) or a recorded `codex-skill-ownership` digest for THIS Codex home (section 5.0); meanwhile `legacyAgents` classifies untouched `0.1.6`–`1.8.x` `.toml` files against `KNOWN_AGENT_TEMPLATES` and historical `codex-agent-ownership` records as `managed-legacy` for automatic retirement;
|
|
706
|
+
* `modified`/`conflict` — everything else.
|
|
707
|
+
|
|
708
|
+
Every release from `0.1.10` through `0.1.13` changes only the version line in the
|
|
709
|
+
companion file, so those templates share one body and differ only in that stamped line.
|
|
710
|
+
`0.1.14` changes the body as well (the per-call decision rules below), which is why its
|
|
711
|
+
predecessor is enumerated as a pinned identity rather than rebuilt. The bytes are what
|
|
712
|
+
ownership is proved against, so every release is enumerated on its own:
|
|
713
|
+
|
|
714
|
+
| Release | Digest enumerated in `KNOWN_AGENT_TEMPLATES` |
|
|
715
|
+
| --- | --- |
|
|
716
|
+
| `0.1.10` | `fc7b27104dbb50f4e614cd4fd8df8db87fd8f59fcf2b3c27b412b49f8b89fbba` (packed CRLF) |
|
|
717
|
+
| `0.1.10` | `6583f08a3ec4912a875249e6b127357b41cc3f8bf388b8e5cadbbeff469349be` (same template, LF) |
|
|
718
|
+
| `0.1.11` | `b6ca7c3258fc00c1c1682abf099994b9f5abe650acc3ecf9635eec4a35520151` (packed) |
|
|
719
|
+
| `0.1.12` | `ff04a4bf2c09b97747f835770c837637869581bb13bad3b8a870a3e92218514f` (packed) |
|
|
720
|
+
| `0.1.13` | `b3a1d2f0520774c0066ea733f27fd47c67c5f5ac44394d0eec2564c7959700aa` (packed, 9191 bytes, CRLF) |
|
|
721
|
+
| `0.1.14` | `11379c0152f3fb2bd4da1170812e51fe68006d98f6378c720cbadcee9ee4750c` (packed) |
|
|
722
|
+
| `1.0.0` | `b1fd531598087564b26df14d3261515e961012f3fd010ea493f222da7bbaf415` (git release bytes, CRLF) |
|
|
723
|
+
| `1.0.0` | `0cce75574107049413f4ddbdf7d8e6cddea92d45a0c4e0fa41b169cb790e5e13` (same template, LF) |
|
|
724
|
+
| `1.0.0` | `a8c888afaa0a1a6a0abfcb56670ffbdb67697f07e54871ece78c8adffb15c149` (**legacy** pinned identity) |
|
|
725
|
+
| `1.0.0` | `f51831e2ff265c9ba63a4760e245787060de7bd91dcc9663a11729fb472e5f62` (**legacy** pinned identity) |
|
|
726
|
+
| `1.1.0` | `7d3ea5c54647a92cebaa0521741eb27f5141f7b2127b47009195fdb976dae4fb` (git release bytes, CRLF) |
|
|
727
|
+
| `1.1.0` | `93d580bd849bb6d2c30c2db6286695ef3e0356896a88e552abae5f03eafc7601` (same template, LF) |
|
|
728
|
+
|
|
729
|
+
The `1.0.0` and `1.1.0` **git-verified** identities come from the release commits
|
|
730
|
+
themselves — `git show 2750047:codex/dsh-delegate.toml` and
|
|
731
|
+
`git show 2d71708:codex/dsh-delegate.toml` — and are kept as fixtures
|
|
732
|
+
(`tests/fixtures/codex-agent-1.0.0.toml`, `…-1.1.0.toml`) that are never packed.
|
|
733
|
+
|
|
734
|
+
The two **legacy** `1.0.0` entries are NOT claimed to be the Git bytes: the fixture above
|
|
735
|
+
is what the release commit contains, and these digests do not match it. They are retained
|
|
736
|
+
because a released build enumerated them, so an installation created by that build stays
|
|
737
|
+
structurally refreshable instead of flipping to "somebody else's file". Labelling them
|
|
738
|
+
`legacy` is the point: keeping an old identity is conservative (an unrecognised file is
|
|
739
|
+
never adopted and never removable), while pretending it came from Git would be a false
|
|
740
|
+
claim.
|
|
741
|
+
|
|
742
|
+
`0.1.10` therefore carries **two** entries, because that release exists in two byte forms
|
|
743
|
+
and either one can be on disk: the CRLF file inside the packed
|
|
744
|
+
`dsh-delegate-0.1.10.tgz`, and the same template kept as LF text. Both are hashes of
|
|
745
|
+
actual published bytes — the LF digest is an exact identity, not a normalized comparison.
|
|
746
|
+
`0.1.11` was delivered as an uncommitted candidate plus a verified tarball (the last
|
|
747
|
+
commit, `a750c0b`, is `0.1.10`), so that digest is cited from the tarball and the saved
|
|
748
|
+
baseline rather than from a `0.1.11` commit. The `0.1.12` digest is likewise verified
|
|
749
|
+
against the `package/codex/dsh-delegate.toml` inside the packed
|
|
750
|
+
`dsh-delegate-0.1.12.tgz` and against the saved release baseline. No earlier digest was
|
|
751
|
+
removed or replaced when a later release was added, so a machine that skipped a release is
|
|
752
|
+
still migrated directly to this build.
|
|
753
|
+
|
|
754
|
+
`0.1.13` is the last release whose companion body is the older one: `0.1.14` added the
|
|
755
|
+
per-call permission decision rules, so the `0.1.13` bytes are **not** recoverable by
|
|
756
|
+
relabelling the current template and are enumerated as an exact identity instead. The
|
|
757
|
+
digest was verified against `package/codex/dsh-delegate.toml` inside the packed
|
|
758
|
+
`dsh-delegate-0.1.13.tgz` (9191 bytes, CRLF) and the file is kept as
|
|
759
|
+
`tests/fixtures/codex-agent-0.1.13.toml`, so the "unchanged `0.1.13` is refreshed" and
|
|
760
|
+
"edited `0.1.13` is preserved" cases are both driven by real published bytes.
|
|
761
|
+
|
|
762
|
+
**Line endings in classification vs. write/delete verification (`1.5.3+`).** Classification
|
|
763
|
+
(`sameAgentText` and `isKnownPriorTemplate`) folds `\r\n` to `\n` (while rejecting any leftover
|
|
764
|
+
lone `\r`, BOM, tab, trailing space, blank line or version edit) so uniform LF, uniform CRLF, and
|
|
765
|
+
mixed CRLF/LF spellings of the exact same published template are recognized without false conflicts;
|
|
766
|
+
new managed files are written in LF, and every overwrite or unlink still re-reads the file and
|
|
767
|
+
requires its exact raw bytes to match `expect`. Both LF and CRLF digests of historical releases
|
|
768
|
+
remain enumerated in `KNOWN_AGENT_TEMPLATES` / `KNOWN_SKILL_TEMPLATES` and pinned by
|
|
769
|
+
`tests/codex-integration.test.js` and `tests/codex-agent-line-endings.test.js`.
|
|
770
|
+
|
|
771
|
+
A digest is added only for a build that was actually packed and verified, and the
|
|
772
|
+
current template's digest is never in the list under an older label; the tests assert
|
|
773
|
+
both facts (`tests/codex-integration.test.js`, `tests/package.test.js`).
|
|
774
|
+
|
|
775
|
+
The 1.7.0 package recognized these two earlier companion versions, each in both
|
|
776
|
+
terminator spellings, and all four are exact identities like every entry above:
|
|
777
|
+
|
|
778
|
+
| Release | Digest enumerated in `KNOWN_AGENT_TEMPLATES` |
|
|
779
|
+
| --- | --- |
|
|
780
|
+
| `1.6.1` | `efdef5f6e6ebcb26590ca929e674391b3c4fcdb3c017714d2322615783fdf712` (all LF) |
|
|
781
|
+
| `1.6.1` | `5da9fd5eb5a89fd3c76365faca78b51e34233d993605f1b55dff4b07ceb88b80` (same template, CRLF) |
|
|
782
|
+
| `1.6.1-test.5` | `bf698c861e7e560c555f8350b711db88627dce4a8752b2cbebe8748b6d640d37` (the packed agent, LF) |
|
|
783
|
+
| `1.6.1-test.5` | `a45e12d0b234e80854e69429518a2def2d00338f968c2ecfc689307b792e4426` (same file, CRLF) |
|
|
784
|
+
|
|
785
|
+
Both carried the SAME instruction body in the 1.6.1 sources and differed only in the
|
|
786
|
+
stamped `version` line, so enumerating both avoided false `modified` conflicts on upgrade.
|
|
787
|
+
|
|
788
|
+
At plugin startup, an `outdated` agent is refreshed automatically only when its
|
|
789
|
+
bytes still match a known shipped build. This does not create a missing agent or
|
|
790
|
+
edit `config.toml`. A file with any other content is preserved, even when its
|
|
791
|
+
version line names an older release.
|
|
792
|
+
|
|
793
|
+
Since 1.2.0 the startup check has a second half: an **already installed** managed
|
|
794
|
+
`mcp_servers.dsh-delegate` entry that is merely `outdated` is upgraded in place (see
|
|
795
|
+
section 2.4). It is still not an install: no entry is created, and no entry the plugin
|
|
796
|
+
cannot prove it wrote is adopted or rewritten.
|
|
797
|
+
|
|
798
|
+
The version line is *never* the proof. A file that still starts with the managed
|
|
799
|
+
header, still contains the dispatch rules, but has an old or invented version line
|
|
800
|
+
and one edited body byte is the operator's: the digest no longer matches, so it is
|
|
801
|
+
`modified`, it is never refreshed, and it is never removed. Conversely a
|
|
802
|
+
byte-exact published build is refreshed and removable, as documented.
|
|
803
|
+
|
|
804
|
+
### 5.0 The recorded template digest (future releases)
|
|
805
|
+
|
|
806
|
+
Enumerating every future release by hand does not scale, so one small record exists beside the
|
|
807
|
+
table: after an **explicit `install`** or the startup **`refreshKnownAgentTemplate`** has written
|
|
808
|
+
the agent file, and only when the file it re-reads is exactly the template this build renders,
|
|
809
|
+
the plugin stores the digest of those bytes.
|
|
810
|
+
|
|
811
|
+
* Path (1.9.0+ native skill): `<DSH_HOME>/data/dsh-delegate/codex-skill-ownership/<sha256 of the real home>.json` — one
|
|
812
|
+
file per pinned Codex home, named by a digest of that home so no case equivalence is ever
|
|
813
|
+
inferred and two homes can never collide. Legacy `<DSH_HOME>/data/dsh-delegate/codex-agent-ownership/`
|
|
814
|
+
records remain readable so untouched pre-1.9.0 `.toml` subagents migrate cleanly.
|
|
815
|
+
* `npm run build:integrations` assembles `SKILL.md` and its rules reference from the shared
|
|
816
|
+
Layer 2 rules in `integrations/core/` through the Layer 1 Codex adapters.
|
|
817
|
+
* Content: `{ "schemaVersion": 1, "codexHome": "<real home>", "templateLfSha256": "<64 hex>" }`.
|
|
818
|
+
The digest is **LF-normalized** (the CRLF/LF spelling is not content, exactly as the table
|
|
819
|
+
treats it), and it is the only digest. No template body, no `config.toml`, no model
|
|
820
|
+
setting, no version, no timestamp, no credential.
|
|
821
|
+
* A file whose digest equals that value is `outdated`. One changed character — an added line, a
|
|
822
|
+
tab, or a rewritten `version` line — hashes differently and stays `modified`.
|
|
823
|
+
* The record is read only: `status`, `repair` and `remove` never write it. A record reached
|
|
824
|
+
through a link or reparse point, missing, unreadable, malformed, over 4 KB, or naming a
|
|
825
|
+
different home is **no record** — the file is then classified by its content alone. A read
|
|
826
|
+
never creates the record directory; a write proves each level first and is atomic, owner-only,
|
|
827
|
+
and read back. An unchanged record is not rewritten. A `DSH_HOME` override must be absolute;
|
|
828
|
+
without one the `~/.dsh` default applies.
|
|
829
|
+
* A failure to record costs the next release one enumeration. It never fails an install and
|
|
830
|
+
never changes how a file is classified.
|
|
831
|
+
|
|
832
|
+
The version line is *never* the proof. A file that still starts with the managed
|
|
833
|
+
header, still contains the dispatch rules, but has an old or invented version line
|
|
834
|
+
and one edited body byte is the operator's: the digest no longer matches, so it is
|
|
835
|
+
`modified`, it is never refreshed, and it is never removed. Conversely a
|
|
836
|
+
byte-exact published build is refreshed and removable, as documented.
|
|
837
|
+
|
|
838
|
+
### From the project plan to a DSH assignment
|
|
839
|
+
|
|
840
|
+
Codex checks the relevant code and earlier deliverables before deciding the next
|
|
841
|
+
step. It tells the operator which packet is ready, how it will work, and what it
|
|
842
|
+
will reuse. The `delegate_submit.prompt` carries the plan DSH executes. Include the
|
|
843
|
+
starting point, implementation order, scope and evidence for acceptance. For
|
|
844
|
+
multi-stage work, keep dependencies and reviewed progress in the existing plan tree.
|
|
845
|
+
The worker handles routine implementation choices and reports verified facts that
|
|
846
|
+
would change the agreed approach. Codex reviews the evidence before advancing
|
|
847
|
+
work that depends on it.
|
|
848
|
+
|
|
849
|
+
### 5.1 Required dispatch semantics
|
|
850
|
+
|
|
851
|
+
The instructions must state all of the following. They are asserted in
|
|
852
|
+
`tests/codex-integration.test.js` and `tests/package.test.js`, so an edit that drops
|
|
853
|
+
one fails the build:
|
|
854
|
+
|
|
855
|
+
1. **Explicit assignment only.** Dispatch only when the user explicitly
|
|
856
|
+
selects this skill (`$dsh-taskbridge`) or explicitly asks to delegate a Git
|
|
857
|
+
repository code implementation or verification task to DSH / TaskBridge.
|
|
858
|
+
2. **Mention is not dispatch.** Text that merely mentions DSH, DeepSeek,
|
|
859
|
+
dsh-delegate, delegation or the agent while asking something else is not a
|
|
860
|
+
dispatch request, and neither is a question about the plugin, its settings or
|
|
861
|
+
its status.
|
|
862
|
+
3. **No dispatch for non-implementation work.** Explanation, planning,
|
|
863
|
+
review-only, summarising and status questions are answered in Codex.
|
|
864
|
+
4. **Ambiguity is a question.** If it is unclear whether the task was assigned, ask
|
|
865
|
+
once instead of dispatching.
|
|
866
|
+
5. **Switch first, facts second.** Call `delegate_status` first (once per session); then call
|
|
867
|
+
`delegate_preflight` with the exact authorized workspace path (or pass `autoPreflight: true, wait: true` on `delegate_submit` for a normal single-repo dispatch, resuming via `delegate_wait` on `submitReceipt.taskId` if `submitted: true` returns with `waitError`). If either fails,
|
|
868
|
+
the tool is missing, the switch is off, or the answer is ambiguous, stop and
|
|
869
|
+
report the bounded refusal. Leave the switch as set and use only the authorized
|
|
870
|
+
TaskBridge execution path.
|
|
871
|
+
6. **The isolation is decided from the measured facts, and never downgraded.**
|
|
872
|
+
`delegate_preflight` returns `isolation` (`worktree` / `shared` / `block`) and a
|
|
873
|
+
stable `reason` code:
|
|
874
|
+
* `worktree` (`PREFLIGHT_CLEAN_REPOSITORY`) — a clean repository; dispatch with
|
|
875
|
+
the worktree isolation selected in the plugin settings, unchanged.
|
|
876
|
+
* `block` + `decisionRequired: true` (`PREFLIGHT_DIRTY_NEEDS_DECISION`) — the
|
|
877
|
+
checkout is dirty, so a worktree cannot be prepared from a commit. The agent
|
|
878
|
+
must **not** silently downgrade and must **not** probe by submitting. As
|
|
879
|
+
coordinator, it inspects the changed-file count and bounded path list and
|
|
880
|
+
decides whether this authorized task can safely run in place while preserving
|
|
881
|
+
the existing changes. It need not ask the operator to choose on every dispatch:
|
|
882
|
+
it states a safe shared decision and its reason before dispatch, re-runs the
|
|
883
|
+
preflight with `allowShared: true`, and proceeds only if the answer is `shared`
|
|
884
|
+
(`PREFLIGHT_DIRTY_SHARED_EXPLICIT`). If ownership, overlap or risk is unclear,
|
|
885
|
+
it pauses for one focused question.
|
|
886
|
+
* `block` for any other reason (`PREFLIGHT_GIT_UNAVAILABLE`,
|
|
887
|
+
`PREFLIGHT_NOT_A_REPOSITORY`, `PREFLIGHT_NO_COMMITS`, `PREFLIGHT_GIT_FAILED`,
|
|
888
|
+
`PREFLIGHT_WORKSPACE_INVALID`, `PREFLIGHT_NOT_A_DIRECTORY`) — stop and report
|
|
889
|
+
the code; no fallback exists.
|
|
890
|
+
7. **The dispatch text carries the workspace facts and the isolation reason.** A
|
|
891
|
+
shared run is named as such, because the worker writes into a checkout that
|
|
892
|
+
already has uncommitted work.
|
|
893
|
+
8. **Route settings stay in the plugin.** For `worktree`, call `delegate_submit`
|
|
894
|
+
without `overrides` so the configured isolation applies. For an explicitly chosen
|
|
895
|
+
`shared` run, pass only `{ isolation: "shared" }` as the per-task override because
|
|
896
|
+
the plugin may still be configured for `worktree`. Never override provider,
|
|
897
|
+
model, effort or timeout, and never encode a route in the prompt. `allowShared`
|
|
898
|
+
on preflight records the decision but does not change the submitted job's
|
|
899
|
+
isolation by itself.
|
|
900
|
+
9. **One task, WAITED — not polled (1.1.0).** Keep the returned `taskId` and call
|
|
901
|
+
`delegate_wait({ taskId })` — with no `waitSeconds` argument — repeating it until it
|
|
902
|
+
returns a reason that needs the host. `delegate_result` is **not** a polling loop: one
|
|
903
|
+
`delegate_wait` blocks internally and re-issues its own bounded observation requests,
|
|
904
|
+
which is the waiting loop. Never submit a duplicate because a task is still running;
|
|
905
|
+
`delegate_cancel` stops it. The wait defaults to 3600 seconds and the tool caps it
|
|
906
|
+
there, so there is nothing to raise: when a wait ends, call it again on the same task.
|
|
907
|
+
A shorter explicit `waitSeconds` stays legal but is only for a one-off diagnostic the
|
|
908
|
+
operator explicitly asked for.
|
|
909
|
+
While the wait runs, stay silent: do not read intermediate code or diffs, do not run
|
|
910
|
+
parallel implementation or research, and do not narrate unchanged snapshots. The only
|
|
911
|
+
exceptions are work explicitly assigned as independent of the task, an inspection the
|
|
912
|
+
operator explicitly asked for, a decision or diagnosis that genuinely needs a fact the
|
|
913
|
+
wait did not return, and an explicit user-authorized takeover. Review happens once, on
|
|
914
|
+
delivery.
|
|
915
|
+
`heartbeat` means "nothing to report" and is internal: the tool re-waits rather than
|
|
916
|
+
handing it to the model, so normal progress never wakes Codex.
|
|
917
|
+
The roughly 25-second internal observation cadence belongs to the program, not to the
|
|
918
|
+
agent: it is not a polling rate the model should imitate.
|
|
919
|
+
10. **Each wait reason has a stated policy (1.1.0+; delivery interval 40 min default from 1.7.0).**
|
|
920
|
+
- `attention` — either the run progress check (no new result delivered back to the host for the
|
|
921
|
+
operator-configured progress-check interval — **40 minutes by default**, adjustable or
|
|
922
|
+
disableable) or a `repeated-tool-failure` reminder. It does **not** mean an ordinary wait
|
|
923
|
+
ended: a wait ending is `wait-limit`. It is a QUESTION, not a verdict: read the compact
|
|
924
|
+
diagnostic (phase, last activity, current tool and its elapsed time, self-check
|
|
925
|
+
verdict) and **default to waiting again** on the same task. Never cancel, never mark
|
|
926
|
+
failed, and never resubmit merely because a task is quiet or one tool or test is
|
|
927
|
+
slow. Only a concrete, stated error justifies anything else, and then it is reported
|
|
928
|
+
rather than silently restarted.
|
|
929
|
+
- `permission` — a per-call decision is outstanding; see item 12. After deciding,
|
|
930
|
+
wait the SAME task again.
|
|
931
|
+
- `ready` — execution finished and the task awaits **host review**; that is not
|
|
932
|
+
acceptance. Read `delegate_result` **once** for full evidence and review it in
|
|
933
|
+
Codex. A large diff is inspected file by relevant file, once each, not re-read.
|
|
934
|
+
- `failed` / `cancelled` — read `delegate_result` once for the recorded reason and
|
|
935
|
+
report it; do not resubmit identical work hoping for a different outcome.
|
|
936
|
+
- `wait-limit` — this call's own wait budget ran out with nothing changed. The answer
|
|
937
|
+
carries `actionable: false` and `terminal: false`: it is not a result, requires no
|
|
938
|
+
business decision, and ends nothing. Immediately `delegate_wait` the same task
|
|
939
|
+
again (no `waitSeconds`). It is not a failure, a stall, or a reason to submit
|
|
940
|
+
anything new or to check the implementation locally.
|
|
941
|
+
A **client-side tool timeout** is a different event and is *not* `wait-limit`: the
|
|
942
|
+
host's own limit ending the call does not prove the execution stopped, and does not
|
|
943
|
+
prove it is alive. Keep the `taskId` and wait again; if a compact fact is genuinely
|
|
944
|
+
needed, read it with `delegate_result`. Never duplicate, restart or cancel a task
|
|
945
|
+
because a wait or a client timeout ended.
|
|
946
|
+
- `interrupted` — **the wait was cut off; that is not by itself a finished
|
|
947
|
+
execution.** One call answers it at once (it does not loop), so the answer's own
|
|
948
|
+
fields decide the response (1.2.0):
|
|
949
|
+
* `terminal: false` with a live `state` (`running`/`pending`): the task is running.
|
|
950
|
+
`delegate_wait` the same task; never resubmit, never implement locally, never
|
|
951
|
+
cancel for this reason.
|
|
952
|
+
* `terminal: true` and `state: "interrupted"`: the TASK record itself is a restart
|
|
953
|
+
history and will not resume. Read `delegate_result` once and report; do not keep
|
|
954
|
+
calling `delegate_wait` on it.
|
|
955
|
+
* `terminal: false` with no state, an unrecognized state, or a state that
|
|
956
|
+
contradicts the record (for example `running` with an end time): neither
|
|
957
|
+
"running" nor "stopped" may be assumed. Keep the task id and check one fact with
|
|
958
|
+
`delegate_result` before deciding — and do not re-wait indefinitely on a task the
|
|
959
|
+
host cannot classify.
|
|
960
|
+
A settled state carried by an `interrupted` observation is reported as that real
|
|
961
|
+
outcome (`awaiting-host-review` → `ready`), so a completed run always reaches review.
|
|
962
|
+
10b. **When the host blocks the connection, the control channel is separate (1.2.0).**
|
|
963
|
+
Some hosts forward one tool call at a time, so a long `delegate_wait` blocks
|
|
964
|
+
`delegate_status`/`delegate_cancel` on that same MCP connection. When — and only
|
|
965
|
+
when — the operator asks to stop or inspect that task in that situation, the agent
|
|
966
|
+
may run `dsh-delegate-control status <taskId>` or
|
|
967
|
+
`dsh-delegate-control cancel <taskId>` from the SAME package directory as the
|
|
968
|
+
configured MCP script (derived from this plugin's own MCP `args[0]`, never another
|
|
969
|
+
script), using the same `node` executable. It cannot submit, change a setting or
|
|
970
|
+
the switch, act on another task, resubmit the work or switch models, and during a
|
|
971
|
+
normal wait it stays silent instead of polling that binary.
|
|
972
|
+
|
|
973
|
+
What the command guarantees, so the expected output is never mistaken for a hang:
|
|
974
|
+
`status` reads the task's CURRENT compact state through ONE observation with the
|
|
975
|
+
smallest positive wait (`waitMs: 1`) — not `waitMs: 0`, which the engine reads as
|
|
976
|
+
"no bound requested" and replaces with a 25-second long poll. The commands answer
|
|
977
|
+
inside a single budget (10 s by default; `DSH_DELEGATE_CONTROL_TIMEOUT_MS` may only
|
|
978
|
+
lower it), enforced through one caller `AbortSignal` with the observation retry
|
|
979
|
+
disabled for that call, so a dead endpoint cannot spend a backoff schedule after
|
|
980
|
+
the answer. A failure — including an exhausted budget, `CONTROL_TIMEOUT` — is one
|
|
981
|
+
bounded JSON document on stdout plus a non-zero exit code, never a stack trace.
|
|
982
|
+
11. **Evidence, not approval.** Return state, the actual provider/model/effort,
|
|
983
|
+
changed-file summary, verification evidence, limitations, and the preflight
|
|
984
|
+
facts with the isolation reason actually used. Executing is not accepting:
|
|
985
|
+
Codex remains responsible for review. Do not claim a check passed without
|
|
986
|
+
evidence, and never commit or push.
|
|
987
|
+
12. **The workspace is not tidied up to pass a check.** No commit, stash, branch,
|
|
988
|
+
worktree creation, `clean`, `reset` or revert on the operator's behalf. A dirty
|
|
989
|
+
workspace is an isolation decision for the coordinator; pause only when the
|
|
990
|
+
existing edits' ownership or risk is unclear.
|
|
991
|
+
13. **A task awaiting a permission decision is still running, and the coordinating
|
|
992
|
+
Codex decides it.** A wait reporting `permission` (with the full redacted request
|
|
993
|
+
at the top level) is the worker paused on one native tool call, not a
|
|
994
|
+
stall: never submit a duplicate, mark it failed, or cancel it merely because it
|
|
995
|
+
waits, and keep waiting the SAME task. The agent does **not** invoke a second
|
|
996
|
+
approval/review model, does **not** ask the operator to choose routine within-task
|
|
997
|
+
decisions, and does **not** delegate the decision to the worker. The worker's own
|
|
998
|
+
`reason` is a claim, never authority. It checks the actual tool, redacted
|
|
999
|
+
arguments, call identity, session and repository against the authorized task,
|
|
1000
|
+
reading local evidence when it needs to understand an executable script or target,
|
|
1001
|
+
and approves only the specific operation the task needs — refusing anything
|
|
1002
|
+
unrelated, destructive or exfiltrating, any credential or configuration change, and
|
|
1003
|
+
any request whose evidence is unknown or materially incomplete. An allow requires
|
|
1004
|
+
`argumentsComplete: true`, `completeness: complete`, `allowBlocked: null`, no
|
|
1005
|
+
transport truncation affecting the pending operation, a still-pending request and
|
|
1006
|
+
its exact `fingerprint`, passed to `delegate_permission_decide` with the `taskId`,
|
|
1007
|
+
`requestId`, `decision` (`allow-once`/`reject`) and a bounded `reason`. An invalid or
|
|
1008
|
+
stale allow grants nothing: re-read the current request and decide safely, and never
|
|
1009
|
+
retry under broader settings. Resume waiting on the same task after the decision.
|
|
1010
|
+
Each approval covers one call (`scope: "once"`). The release treats the preview
|
|
1011
|
+
value `scope: "task-command"` on an `allow-once` request as a single-call approval.
|
|
1012
|
+
Make a fresh decision for each subsequent approval request. When dispatching on
|
|
1013
|
+
behalf of a parent commander, preserve the complete request evidence for that commander.
|
|
1014
|
+
14. **No local implementation while a delegated worker runs (1.1.0).** Neither the
|
|
1015
|
+
dispatch companion nor the parent commander writes, patches or "just fixes" the
|
|
1016
|
+
implementation while a delegated task is running, waiting, or awaiting review: that
|
|
1017
|
+
would make the reviewer a second implementer of the same change, produce conflicting
|
|
1018
|
+
edits in one workspace, and break the single-writer property the isolation mode
|
|
1019
|
+
provides. The only exception is an explicit, user-authorized takeover — the operator
|
|
1020
|
+
saying to take over and implement it here. A long silence, a permission refusal, a
|
|
1021
|
+
failed run, a wait-limit or the commander's own opinion of the plan is **not** that
|
|
1022
|
+
authorization. Permitted local actions while a task runs are: reading status and
|
|
1023
|
+
diagnostics, waiting, reading evidence, deciding a pending permission, cancelling,
|
|
1024
|
+
and writing the follow-up prompt. A believed-wrong result is reported and proposed
|
|
1025
|
+
as a follow-up in the same chain, never applied locally.
|
|
1026
|
+
15. **No secrets.** Never read, request, store or relay provider credentials or
|
|
1027
|
+
connection tokens.
|
|
1028
|
+
16. **Task threads are explicit.** A submission starts a NEW DSH task conversation
|
|
1029
|
+
by default; a directory-level reuse setting no longer exists. `continueFromTaskId`
|
|
1030
|
+
is passed **only** for a follow-up change, correction or retry that belongs to one
|
|
1031
|
+
earlier delegated task, and its value is the latest prior task id of that chain.
|
|
1032
|
+
An unrelated task, a new topic or a different workspace omits `continueFromTaskId` entirely:
|
|
1033
|
+
an id is never reused "to keep context" and never guessed. For a new dependent multi-stage subtask that starts a fresh DSH Session directly on an earlier accepted isolated worktree under the same source repository, pass `reuseWorktreeFromTaskId` instead (never combined with `continueFromTaskId`). A follow-up to a
|
|
1034
|
+
`worktree` task keeps its original source `workspacePath` for preflight and
|
|
1035
|
+
submit; the plugin resolves the same internal tree and continues its earlier
|
|
1036
|
+
uncommitted changes there. Never send the tree's internal execution path as the
|
|
1037
|
+
authorization path or choose a new isolation override. A refusal naming an
|
|
1038
|
+
unavailable or mismatched tree is reported and escalated, never worked around
|
|
1039
|
+
by re-submitting as a new task. The run's report states which of the two happened.
|
|
1040
|
+
Corrections are consolidated into one follow-up submission rather than a scatter of
|
|
1041
|
+
new tasks.
|
|
1042
|
+
|
|
1043
|
+
### 5.2 Native Skill invocation (`$dsh-taskbridge`, 1.9.0+) vs. legacy `@` selection
|
|
1044
|
+
|
|
1045
|
+
From `1.9.0`, TaskBridge installs a **native Codex Skill** at
|
|
1046
|
+
`$CODEX_HOME/skills/dsh-taskbridge/SKILL.md`. An explicit `$dsh-taskbridge` activation or request
|
|
1047
|
+
to delegate to DSH / TaskBridge loads the entry. The active Codex session calls `delegate_submit` + a single direct `delegate_wait` chain without spawning
|
|
1048
|
+
a `spawn_agent` / `wait_agent` polling wrapper.
|
|
1049
|
+
|
|
1050
|
+
For pre-1.9.0 legacy subagent installations (`$CODEX_HOME/agents/dsh-taskbridge.toml`), this
|
|
1051
|
+
plugin never claimed `@dsh-taskbridge` picker support across all Codex builds. A new Codex session
|
|
1052
|
+
(or restart) is required after install or migration so Codex reloads the native skill and MCP entry.
|
|
1053
|
+
|
|
1054
|
+
---
|
|
1055
|
+
|
|
1056
|
+
## 6. Failure modes a reviewer should check
|
|
1057
|
+
|
|
1058
|
+
| Situation | Expected |
|
|
1059
|
+
| --- | --- |
|
|
1060
|
+
| `CODEX_HOME` relative | 400 `CODEX_HOME_INVALID`; nothing read or written |
|
|
1061
|
+
| `CODEX_HOME` unset | diagnosed against `~/.codex` |
|
|
1062
|
+
| `$CODEX_HOME` is a normal symlink or Windows junction | pin and verify its real directory target, preserve the root alias, then apply the same managed-content checks; broken or unverifiable targets are refused |
|
|
1063
|
+
| `$CODEX_HOME/skills`, `skills/dsh-taskbridge`, or `agents` is a symlink or Windows junction | `conflict` (`skills-dir-is-link` / `skill-dir-is-link` / `agents-dir-is-link`); install/repair/remove refuse with `AGENT_PATH_CONFLICT` and no file is created outside the home |
|
|
1064
|
+
| an ordinary real Windows directory | `directory` in every spelling of the helper's boolean (`dir/False`, `dir/false`); never reported as a link |
|
|
1065
|
+
| `repair` with the skill file missing or `outdated` | `changed: ["mcp"]` or `[]`; the skill file is not created and not refreshed, and neither `skills/` nor `agents/` is created |
|
|
1066
|
+
| the boundary cannot be verified (no spawnable shell / no PowerShell) | `conflict` (`boundary-unverified`); everything refused, nothing assumed safe |
|
|
1067
|
+
| `skills/dsh-taskbridge` dir missing | created on explicit `install` (`0700`) when the boundary is clean |
|
|
1068
|
+
| `skills/dsh-taskbridge/SKILL.md` is a symlink or a directory | `conflict`; untouched |
|
|
1069
|
+
| a different skill file appears between status and install | `modified`; untouched (first install is exclusive) |
|
|
1070
|
+
| a skill file is rewritten between the status read and `remove` | `AGENT_USER_MODIFIED` (`modified-before-removal`); the new bytes are kept |
|
|
1071
|
+
| the skill path is replaced by a directory / a link before `remove` | `AGENT_PATH_CONFLICT`; the entry is left in place |
|
|
1072
|
+
| an edited skill file with an old version comment | `modified` (`reason: edited` if body matches current template); never refreshed, never removed |
|
|
1073
|
+
| a byte-exact previously published skill or legacy `.toml` | `outdated` / `managed-legacy`; refreshed/migrated on install or startup refresh, removed on `remove` |
|
|
1074
|
+
| `config.toml` is a symlink | `unreadable`; refused |
|
|
1075
|
+
| `config.toml` > 1 MiB | refused (`other`), untouched |
|
|
1076
|
+
| `config.toml` contains a NUL / control character | `CODEX_CONFIG_UNSUPPORTED`, untouched |
|
|
1077
|
+
| `config.toml` uses CRLF | edited in place; CRLF and every unrelated byte preserved |
|
|
1078
|
+
| an unmarked same-name `mcp_servers.dsh-delegate` entry | `conflict` (`unmanaged-entry`); byte-identical after install/repair/remove |
|
|
1079
|
+
| an unmarked entry that is EXACTLY the owned entry (same command, single script argument, timeout and env) in one unambiguous standard table | `conflict` (`unmanaged-entry-exact`); byte-identical after install/remove, and `repair` adds the one marker line |
|
|
1080
|
+
| an unmarked entry with a duplicated key, an inline table beside the header, or an extra/empty sub-table | `conflict` (`unmanaged-entry`); byte-identical after install/repair/remove |
|
|
1081
|
+
| entry added between the read and the write | re-classified; refused if it stopped being ours |
|
|
1082
|
+
| package `bin/dsh-delegate-mcp.js` missing | MCP refused (`MCP_SCRIPT_MISSING`), agent still installed |
|
|
1083
|
+
| plain Node.js host (`process.execPath` is a Node binary) | `command` is that path; no override is consulted |
|
|
1084
|
+
| DSH Desktop host (`process.versions.electron` set) | `command` is the bundled runtime, **never** `DeepSeek Harness.exe` |
|
|
1085
|
+
| desktop host that exposes no `resourcesPath` | `<dirname(execPath)>/resources` is derived and the bundled runtime is used |
|
|
1086
|
+
| bundled runtime missing, `DSH_NODE_PATH` set to an absolute existing file | that file is written as `command` |
|
|
1087
|
+
| an override that is relative / a directory / a link / missing | ignored; the next candidate is tried, and the reason is kept in `nodeError.details.rejected` |
|
|
1088
|
+
| no candidate can be proved | status: `mcp.node = null`, `nodeResolved: false`, `ready: false`; install/repair refuse `MCP_EXECUTABLE_UNRESOLVED`; `config.toml` byte-identical; agent file still installed |
|
|
1089
|
+
| no candidate can be proved, an owned entry already points at a stale command | left as written (nothing is guessed); the note names the environment variable to set |
|
|
1090
|
+
| DSH has no execution plane (public bind) | unchanged by this feature; delegation still refuses |
|
|
1091
|
+
| the agent is asked to dispatch into a dirty repository | `delegate_preflight` answers `block` / `PREFLIGHT_DIRTY_NEEDS_DECISION`; the coordinator evaluates the listed paths and task, then either reports and dispatches with an isolation-only `shared` override or pauses when risk/ownership is unclear |
|
|
1092
|
+
| the agent is asked to dispatch into a non-repository or commit-less directory | `block` with the matching `PREFLIGHT_*` code; the agent stops and reports it rather than submitting |
|
|
1093
|
+
| the workspace path is relative, missing or a file | `block` / `PREFLIGHT_WORKSPACE_INVALID` or `PREFLIGHT_NOT_A_DIRECTORY`; nothing is resolved against the process cwd |
|
|
1094
|
+
| `delegate_preflight` is called while the switch is off | answered normally: it authorizes nothing, and that is when a coordinator needs it most |
|
|
1095
|
+
| `delegate_preflight` is sent `allowShared: "true"` | `MCP_ARGUMENT_TYPE`; the plane is not called |
|
|
1096
|
+
| `delegate_submit` is called twice for one directory | two Sessions in one Workspace: a new submission never continues a previous one |
|
|
1097
|
+
| `delegate_submit` sends `continueFromTaskId` for an unknown, pruned or live parent | the run fails with `JOB_CONTINUATION_REFUSED` and `error.details.session` = `SESSION_CONTINUATION_UNKNOWN` / `SESSION_CONTINUATION_STATE`; no conversation is started |
|
|
1098
|
+
| a follow-up names a parent that ran elsewhere (another directory, another worktree, another repository) | `JOB_CONTINUATION_REFUSED` with `SESSION_CONTINUATION_PATH_MISMATCH` / `SESSION_CONTINUATION_WORKSPACE_MISMATCH`; nothing runs |
|
|
1099
|
+
| a follow-up to a `worktree` task is submitted with the source checkout | accepted: the source path remains the authorization/preflight path, and the engine restores the parent's exact managed tree internally |
|
|
1100
|
+
| a follow-up's recorded tree was removed or belongs to another run | `SESSION_CONTINUATION_UNAVAILABLE` with the stated reason; no fresh tree is prepared |
|
|
1101
|
+
| `continueFromTaskId` is not a string | refused at the MCP schema (`MCP_ARGUMENT_TYPE`) and again by the engine (`JOB_CONTINUATION_REFUSED`) |
|
|
1102
|
+
| the settings page is asked to save a conversation mode | `setConversation` refuses with `CONVERSATION_MODE_REMOVED`; the stored legacy value is untouched and still inert |
|