mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-28 01:15:01 +08:00
roadmap: #282 filed
This commit is contained in:
12
ROADMAP.md
12
ROADMAP.md
@@ -17181,3 +17181,15 @@ Gap. There is no dogfood filing transaction ledger with phases like `planned`, `
|
||||
Required fix shape: (a) before committing, create a durable filing transaction record with `pinpoint_id`, branch, expected commit message, report body, target channel, and idempotency key; (b) update it after commit, origin push, fork push, and Discord send, including message id(s); (c) on agent/gateway restart, scan for records stuck at `pushed_*` but not `report_posted` and publish an idempotent recovery report; (d) include the transaction id in both commit body and Discord post so duplicates can be suppressed; (e) add tests simulating crash-after-push-before-post to prove the report is recovered exactly once. Acceptance: a successful ROADMAP push can never remain silently unreported after a crash; recovery is automatic and machine-auditable.
|
||||
|
||||
**Status:** Open. No source code changed. Filed 2026-04-26 17:32 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `cf32b83` before filing. Cluster delta: dogfood-filing-transactionality +1; sibling to #269/#277 delivery-layer gaps, distinct git↔chat two-phase atomicity layer. Concrete delta this cycle: ROADMAP-only pinpoint appended from #407 crash-after-push-before-post evidence.
|
||||
|
||||
## Pinpoint #282 — `--cwd` flag is parsed only by the `system-prompt` subcommand; the primary `claw -p` runtime dispatch path has no `--cwd` override and silently uses the process's `env::current_dir()` for tool execution, bash, file_ops, and git_context
|
||||
|
||||
Dogfooded 2026-04-26 17:35 KST. Static audit of `rust/crates/rusty-claude-cli/src/main.rs` shows exactly two occurrences of the literal string `"--cwd"`: one in `parse_system_prompt_args` at `:1950` (for `claw system-prompt --cwd <path>` only) and one inside a test fixture at `:10307` exercising that same subcommand. The 25+ other call sites that resolve a working directory all call `env::current_dir()` unconditionally (`:501, :514, :553, :1820, :1834, :1888, :1898, :2263, :2327, :3354, :3572, :3607, :3628, :3638, :3671, :3687, :3812, :3889, :3946, :4513, :4978, :5177, :5198, …`), meaning `claw -p "x"`, `claw run-prompt`, `claw query-tools`, `claw doctor`, `claw render-diff` and friends all operate on whatever directory the shell was in when the binary launched, with no flag to override.
|
||||
|
||||
Gap. Operators wrapping claw-code in dispatchers, schedulers, IDE agents, MCP brokers, and per-task worktree harnesses (the exact shape of the dogfood loop, of `oh-my-o p e n c o d e`, of CI runners, of subagent spawners) cannot point a single long-lived claw process at different working directories per invocation. They have to either `cd` in a wrapping shell (which is racy across concurrent invocations of one process and impossible across threads of one process) or spawn a fresh process with `Command::current_dir`. The official upstream Claude Code CLI documents `--cwd` as a top-level flag (`https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/cli-reference`) so dispatchers built against upstream silently drop the directory hint when pointed at claw-code, and the bash tool, file_ops, git_context, hook execution, and session save/load all anchor on the wrong directory with no error and no warning. PARITY.md does not list `--cwd` in its supported-flags table, but the `system-prompt` subcommand's local `--cwd` parser creates a misleading half-implementation that hides the runtime-path gap from grep-based audits.
|
||||
|
||||
Distinct from #149 (working-directory permission policy), #178 (allow-broad-cwd), and #277 (channel target resolution): those govern whether a cwd is permitted, whether broad cwds are gated, and where a report is sent. #282 is upstream of all three — without a `--cwd` flag on the runtime path, the policy never receives an explicit caller-supplied directory to evaluate; it only sees the inherited process cwd. Distinct from MCP-axis (#254/#268/#274/#275) because `--cwd` governs the host-side process's filesystem anchor before any MCP server is contacted.
|
||||
|
||||
Required fix shape: (a) extend the global argument parser at `:824-1264` (where `allow_broad_cwd`, `--output-format`, `--date` and friends are wired) to recognize a top-level `--cwd <path>` flag that is canonicalized once and threaded into every command variant (`Run`, `Query`, `Doctor`, `RenderDiff`, `RunPrompt`, `RunPromptJson`, etc.) via a single `cwd: Option<PathBuf>` field on the dispatch struct; (b) replace the 25+ raw `env::current_dir()` calls inside the runtime crate with a `resolve_cwd(global_cwd_override)` helper that prefers the explicit override and falls back to `env::current_dir()` only when none was supplied; (c) audit `bash.rs`, `file_ops.rs`, `git_context.rs`, `hooks.rs`, `branch_lock.rs`, and `compact.rs` so each receives the resolved cwd as a parameter rather than re-querying `env::current_dir()` on its own; (d) reuse `enforce_broad_cwd_policy` against the explicit override so #178's policy gate triggers on caller-supplied paths; (e) add an integration test running `claw -p "pwd via bash tool" --cwd /tmp/scratch` from a different process cwd and asserting the bash tool's `pwd` output is `/tmp/scratch`, not the launcher's directory; (f) document `--cwd` in `--help`, `claw doctor --output-format json`'s capability block, and PARITY.md's supported-flags table so the upstream gap is no longer silent. Acceptance: a long-lived claw process or per-task dispatcher can point each `claw -p` invocation at a distinct working directory by flag without spawning a new OS process or mutating the parent process's cwd.
|
||||
|
||||
**Status:** Open. No source code changed. Filed 2026-04-26 17:38 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `db27ac2` before filing (post fast-forward onto gaebal-gajae's #281 dogfood-filing-transactionality pinpoint). Cluster delta: founds NEW `cwd-flag-runtime-dispatch-gap` cluster (1 member, #282 solo founder); cross-cluster with silent-fallback family (claw-code silently inherits parent process cwd instead of erroring on missing `--cwd`), with PARITY.md half-implementation pattern, and with #178/#149 cwd-policy-gate axis (upstream of policy enforcement). Concrete delta this cycle: ROADMAP-only pinpoint appended after static audit confirmed exactly two `"--cwd"` literal occurrences (one in `parse_system_prompt_args`, one in a test fixture), zero on the primary runtime dispatch path. Concurrent-dogfood-rebase parity will be confirmed local==origin==fork at HEAD `db27ac2+#282` after push.
|
||||
|
||||
Reference in New Issue
Block a user