Skip to content

fix(send): work when run from a repo subdirectory#28

Merged
omarkohl merged 1 commit into
mainfrom
jip/work-when-run-from-a-repo/spnlkopr
Jul 4, 2026
Merged

fix(send): work when run from a repo subdirectory#28
omarkohl merged 1 commit into
mainfrom
jip/work-when-run-from-a-repo/spnlkopr

Conversation

@omarkohl

@omarkohl omarkohl commented Jul 4, 2026

Copy link
Copy Markdown
Owner

This is a stacked PR1. Only review commit 9990c9b.

PRs:


Description

Every jj command was invoked with -R , but -R does not search parent
directories, so send failed anywhere below the repo root. Resolve the
workspace root via 'jj root' and anchor the runner there.

Footnotes

  1. A stacked PR is a pull request that depends on other pull requests. The current PR depends on the ones listed below it and MUST NOT be merged before they are merged. The PRs listed above the current one in turn depend on it and won't be merged until the current one is. Learn more about why and how to review.

Every jj command was invoked with -R <cwd>, but -R does not search parent
directories, so send failed anywhere below the repo root. Resolve the
workspace root via 'jj root' and anchor the runner there.
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Informational

1. Misleading debug command log 🐞 Bug ◔ Observability
Description
WorkspaceRoot runs jj root with cmd.Dir = dir, but the debug output logged via `logCmd("jj",
args) prints only jj root` without the working directory, so the logged command is not sufficient
to reproduce/debug failures that depend on dir (e.g., running from a subdirectory).
Code

internal/jj/runner.go[R85-91]

+	args := []string{"root"}
+	logCmd("jj", args)
+	cmd := exec.Command("jj", args...)
+	cmd.Dir = dir
+	var stderr strings.Builder
+	cmd.Stderr = &stderr
+	out, err := cmd.Output()
Evidence
The command is executed in a specific working directory (cmd.Dir = dir), but logCmd only prints
the program and args, so the debug line does not capture the actual execution context.

internal/jj/runner.go[81-100]
internal/jj/runner.go[308-329]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`WorkspaceRoot` changes the command working directory (`cmd.Dir = dir`) but the debug logging (`logCmd`) prints only the program/args. This makes the debug output misleading/non-reproducible because `jj root` behavior depends on the current directory.

## Issue Context
Other jj invocations include `-R <repoDir>` so the working directory is irrelevant, but `WorkspaceRoot` intentionally relies on `cmd.Dir` to locate the repo.

## Fix Focus Areas
- internal/jj/runner.go[84-100]
- internal/jj/runner.go[308-329]

## Suggested fix
When debug logging is enabled, include `dir` in the debug output for `WorkspaceRoot`, e.g.:
- log a separate line like `slog.Debug("jj exec", "dir", dir, "cmd", "jj root")`, or
- extend `logCmd` to accept an optional working directory and emit `cd <dir> && jj ...`, or
- inline the debug output in `WorkspaceRoot` to print `DEBUG $ (cd '<dir>' && jj root)`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@omarkohl

omarkohl commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author
  1. Misleading debug command log 🐞 Bug ◔ Observability

The purpose is just to give you a copy-pasteable command. The user knows what directory they are currently in.

@omarkohl omarkohl merged commit 52b2380 into main Jul 4, 2026
1 check passed
@omarkohl omarkohl deleted the jip/work-when-run-from-a-repo/spnlkopr branch July 4, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant