[Bug]: mcode init fails with "Session Project could not be resolved" for relative directories (default ".")
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
Read packages/tui/src/cli/program.ts and the workspace handling in packages/tui/src/tui/launcher.ts; the issue traces how the relative directory reaches session creation. Run vitest run --config vitest.oss.config.mjs packages/tui/test/unit/tui-app.test.ts to check the default and explicit-relative-directory regression cases. Done means both forms pass an absolute workspace directory and mcode init succeeds in a fresh repository; the issue already includes a verified patch and tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Product or interface
CLI - interactive TUI
Version
@minimax-ai/code0.6.12 (npm)- Reproduced from source at commit
9a935605956c4500e9cb415f29258e2887e97817(repository package version0.6.5) - Node.js 24.21.0; Bun 1.4.2 used for install/build
Platform
Linux
OS version and architecture
Linux 7.2.9 x64 (NixOS), foot 1.28.0 / Wayland
Issue area
File / workspace / path / encoding
Steps to reproduce
cdinto any existing git repository.- Run
mcode initwith no argument, or with any relative directory:mcode init .,mcode init sub/dir. - The TUI opens, submits
/init, and the first turn fails immediately.
Minimal synthetic repro:
mkdir /tmp/repro && cd /tmp/repro
git init -q && echo x > README.md && git add -A && git commit -qm init
mcode init
Passing an absolute directory avoids the failure: mcode init "$PWD".
Expected and actual behavior
Expected: the Session workspace resolves to the target repository and the Runtime init skill runs to generate AGENTS.md.
Actual: Session creation fails with Session Project could not be resolved. /retry repeats the same failure because the same relative workspace value is reused, so the command never proceeds.
Redacted error summary
Released 0.6.12 bundle:
$ mcode init
Working | . | MCode
× Error The response failed.
Reason: Session Project could not be resolved
Run /retry to resend your last message. Your prompt is preserved.
Same failure on a source build at 9a93560, captured in a pty (workspace title is the literal .):
ARGS=['init'] ERROR_SEEN=True TITLES=['. ', '. ']
× Error The response failed.
Reason: Session Project could not be resolved
After resolving the argument to an absolute path (patch below), the same harness:
/tmp/mcode-init-repro │ ⎇ master │ Auto │ … │ Context 98% left
└ Completed in 12s
The status bar shows the absolute workspace and the init skill completes normally. No /retry needed.
Root cause
Traced on main at 9a93560:
packages/tui/src/cli/program.ts:96—.argument('[directory]', 'project directory', '.')defaults to".".packages/tui/src/cli/program.ts:97-98— the action forwards the raw value:launchTui(withLane({ initialPrompt: '/init', workspaceDir: directory })).packages/tui/src/tui/launcher.ts:184—const workspaceDir = options.workspaceDir ?? process.cwd();falls back only forundefined, so"."survives.packages/local-runtime-v2/src/service/session-system/projects/repo/drizzle.ts:89-91—canonicalProjectWorkspaceDir(workspaceDir)returnsundefined, so no project row is created.packages/local-runtime-v2/src/service/session-system/shared/workspace.ts:9-17→shared/path-normalization.ts:3-8—normalizeAbsolutePathexplicitly returnsundefinedwhen!flavor.isAbsolute(input).packages/local-runtime-v2/src/service/session-system/sessions/support/native-record-factory.ts:68-72— Session creation throwsworkspace-requiredwith the message above.
So the CLI accepts a relative path that the project layer can never canonicalize; exec --cwd and normal TUI launches are unaffected because they resolve to absolute paths earlier.
Proposed fix
Resolve the argument at the CLI boundary, where the invalid value originates:
diff --git a/packages/tui/src/cli/program.ts b/packages/tui/src/cli/program.ts
@@
+import { resolve } from 'node:path';
import { Command, InvalidArgumentError } from 'commander';
@@
.action((directory: string) =>
- options.launchTui(withLane({ initialPrompt: '/init', workspaceDir: directory })),
+ options.launchTui(withLane({ initialPrompt: '/init', workspaceDir: resolve(directory) })),
);
Two regression tests added in packages/tui/test/unit/tui-app.test.ts: the default init form and an explicit relative directory both assert an absolute workspaceDir.
Validation
vitest run --config vitest.oss.config.mjs packages/tui/test/unit/tui-app.test.ts— 366 passed (includes the 2 new tests).tsc -p tsconfig.standalone.json --noEmit— exit 0, no output.- Manual, source build at
9a93560+ patch, fresh git repo:mcode initreaches the init skill and completes, error gone. - Not run: CI, macOS/Windows, and a rebuild of the published 0.6.12 bundle (the npm tarball does not map to this source revision).
Workaround
Use an absolute path: mcode init "$PWD" (or mcode init /path/to/repo). Alternatively launch mcode in the repository and type /init.
Additional context
I searched existing issues for the exact message and for mcode init / AGENTS.md init / relative-path reports and found no duplicate. Note the public repository currently reports package version 0.6.5 while npm ships 0.6.12; the failing code path is identical in both.
CONTRIBUTING.md limits code PRs to repository collaborators, so I am filing this as an issue with the verified patch. I am happy to submit a PR if you would like one, or to test a fix on another platform.
Before submitting
- I have searched existing issues.
- I have included my version and removed sensitive information.
- Ngôn ngữ chính
- TypeScript
- Star
- 2k
- Fork
- 259
- Merge trung bình
- 7 giờ 56 phút
- Pull request đã merge (30 ngày)
- 126
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MiniMax-AI/minimax-code
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MiniMax-AI/minimax-code#507 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage tui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MiniMax-AI/minimax-code#481 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug cli documentation needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MiniMax-AI/minimax-code#299 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
MiniMax-AI/minimax-code#514 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
desktop
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
MiniMax-AI/minimax-code#513 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MiniMax-AI/minimax-code
Issue tương tự
-
skillopt: success-reflect prompt omits the edit schema, so every success-only edit is droppedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Workspace secrets/constants containing "$" are corrupted when resolved in data source optionsĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
mobile-next/mobile-mcp#526 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 73/100
redhat-developer/rhdh-plugin-export-overlays#4470 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày