v1.0.6 — fix runJob silent-on-exit-0 + cross-plugin state-dir (issue #10)
Two-part patch for #10: `companion.mjs task` reported "completed exit 0" with empty stdout/stderr logs, breaking `grok-rescue`. Triaged with codex + gemini in parallel.
Fixed
runJob diagnostic-gate bug
v1.0.1/v1.0.5's empty-output diagnostic in `runJob` was nested inside `(code !== 0 || grokInternalError)`. Exit-0 with empty output AND no JSON error envelope fell into the `else` (status=completed) branch and the diagnostic was silently skipped. Reporter saw "Job xxx completed (exit 0)" with 0-byte logs and no signal.
Fix: `runJob` now sets `meta.no_output = true` whenever both buffers are whitespace-only. New `else if (meta.no_output && status !== "cancelled")` branch fires the diagnostic on exit 0 too. `cmdResult` also surfaces the warning when `meta.no_output` is true so users discovering the empty output later get the same recovery hints.
Cross-plugin state-dir collision
Reporter's grok job state landed at `~/.claude/plugins/data/codex-openai-codex/state/...`. `CLAUDE_PLUGIN_DATA` inherits to child processes, so when grok is invoked from a parent codex/gemini subagent, our state went into their namespace.
Fix: `stateDir` now prefixes the env-backed base with `grok-plugin-cc/`, matching the `/tmp/grok-plugin-cc/` namespace already in `FALLBACK_STATE_ROOT`. Paths become `$CLAUDE_PLUGIN_DATA/grok-plugin-cc/state/-/` regardless of which plugin owns the env-set base.
Back-compat: pre-v1.0.6 jobs at `$CLAUDE_PLUGIN_DATA/state/...` become inaccessible after upgrade. Job logs are ephemeral (`MAX_JOBS=50`), configs recreated by `/grok:setup` — acceptable for a patch.
Investigated, not changed
Codex hypothesized that `--permission-mode plan` suppresses tool execution in headless `-p` mode. A/B test refuted this (both plan and default modes produced legit weather data via web_search). `cmdTask`'s default permission-mode stays `plan`. The reporter's specific case is likely the same upstream silent-abort pattern as issue #9.
Tests
10 new behavioral tests in `tests/v1-0-6-issue-10.test.mjs`. 396 tests total (391 passing + 5 integration skipped).
Update
`/plugin` → `Manage installed plugins` → `grok@grok-plugin-cc` → `Update` → `/reload-plugins`.