Problem
When using the cc:rescue skill through the built-in forwarding child path, a reserved task job id can fail with:
Claude Code job id task-... is not reserved. Reserve one with the companion reserve-job helper before reusing it
In my session, background-routing-context --kind task --json returned a non-empty jobId, but forwarding that --job-id to claude-companion.mjs task from the spawned child failed with the message above. Running the same rescue flow without --job-id succeeded.
Likely Cause
The reservation appears to be workspace-scoped.
Relevant local behavior:
background-routing-context resolves cwd via resolveCommandCwd()
- it resolves workspace via
resolveCommandWorkspace({ cwd })
- it writes the reservation under
resolveJobsDir(workspaceRoot)
task --job-id validates the id by checking for the same reservation file under the workspace resolved from its own cwd
The current rescue skill guidance says to call:
node "<plugin-root>/scripts/claude-companion.mjs" background-routing-context --kind task --json
and then pass the returned --job-id into the companion task command.
However, it does not explicitly require the forwarding child to run from the same cwd, nor does it require passing --cwd <original-workspace-cwd> into both the routing-context call and the final task call. If the built-in child starts in a different cwd, the reservation lookup uses a different workspace hash and fails.
Reproduction
From a Codex session using the cc:rescue skill:
- Run the rescue skill path that captures routing context:
node "<plugin-root>/scripts/claude-companion.mjs" background-routing-context --kind task --json
- Use the returned
jobId in the spawned forwarding child command:
node "<plugin-root>/scripts/claude-companion.mjs" task --job-id <returned-job-id> --view-state on-success "<task>"
- If the child process resolves a different cwd/workspace than the parent, the command fails:
Claude Code job id <returned-job-id> is not reserved. Reserve one with the companion reserve-job helper before reusing it
- Running without
--job-id can still succeed, which suggests the task path works but the reserved-id validation is losing workspace identity.
Expected Behavior
The built-in rescue forwarding path should preserve the workspace used to reserve the job id.
Possible fixes:
- Update the rescue skill instructions to capture the original cwd and pass
--cwd <cwd> consistently to both:
background-routing-context --kind task --cwd <cwd> --json
task --cwd <cwd> --job-id <reserved-job-id> ...
- Or make
background-routing-context return the resolved workspace/cwd that must be forwarded with the job id.
- Or make the companion command provide a clearer diagnostic when the reservation exists under a different workspace hash.
Acceptance
- A reserved
jobId returned by background-routing-context works when forwarded through the built-in rescue child.
- The rescue skill documentation explicitly preserves cwd/workspace identity for reserved job ids.
- The failure message or debug output makes cwd/workspace mismatch distinguishable from an actually missing reservation.
Problem
When using the
cc:rescueskill through the built-in forwarding child path, a reserved task job id can fail with:In my session,
background-routing-context --kind task --jsonreturned a non-emptyjobId, but forwarding that--job-idtoclaude-companion.mjs taskfrom the spawned child failed with the message above. Running the same rescue flow without--job-idsucceeded.Likely Cause
The reservation appears to be workspace-scoped.
Relevant local behavior:
background-routing-contextresolves cwd viaresolveCommandCwd()resolveCommandWorkspace({ cwd })resolveJobsDir(workspaceRoot)task --job-idvalidates the id by checking for the same reservation file under the workspace resolved from its own cwdThe current rescue skill guidance says to call:
node "<plugin-root>/scripts/claude-companion.mjs" background-routing-context --kind task --jsonand then pass the returned
--job-idinto the companion task command.However, it does not explicitly require the forwarding child to run from the same cwd, nor does it require passing
--cwd <original-workspace-cwd>into both the routing-context call and the finaltaskcall. If the built-in child starts in a different cwd, the reservation lookup uses a different workspace hash and fails.Reproduction
From a Codex session using the
cc:rescueskill:node "<plugin-root>/scripts/claude-companion.mjs" background-routing-context --kind task --jsonjobIdin the spawned forwarding child command:--job-idcan still succeed, which suggests the task path works but the reserved-id validation is losing workspace identity.Expected Behavior
The built-in rescue forwarding path should preserve the workspace used to reserve the job id.
Possible fixes:
--cwd <cwd>consistently to both:background-routing-context --kind task --cwd <cwd> --jsontask --cwd <cwd> --job-id <reserved-job-id> ...background-routing-contextreturn the resolved workspace/cwd that must be forwarded with the job id.Acceptance
jobIdreturned bybackground-routing-contextworks when forwarded through the built-in rescue child.