[bug] an unreadable project config falls back to the user scope in autoDetectInit
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- cli
Research direction
Start at autoDetectInit in src/config.ts and compare its detectProjectConfig handling with resolveConfigForDir and pull's unreadable-config path. Trace representative callers in push.ts, status.ts, and uninstall.ts, then add the corresponding broken-partition-config tests. Done means the unreadable file and reason are reported, the command exits 1, and the user scope remains untouched.
Written by the indexing model from the issue text.
Description
Description
A project whose teamai config can't be read is treated as "no project here": the command falls back to the user scope and acts on the user's team instead.
autoDetectInit(cwd) src/config.ts:646
detectProjectConfig(cwd, undefined, …) onUnreadable = undefined → reason dropped
project config unreadable → null
null → requireInit() user scope
→ push / status / uninstall / remove / hooks / models / mcp … run against the user's team
resolveConfigForDir (src/config.ts:376) already does it right: an unreadable project config returns null instead of the user scope, and pull names the file. autoDetectInit has 48 call sites across push.ts, status.ts, uninstall.ts, remove.ts, mcp-cmd.ts, models-cmd.ts, hooks-cmd.ts, projects-cmd.ts, roles-cmd.ts, import*.ts and others.
Expected: the command names the unreadable file and why, exits 1, and touches nothing.
Proposed fix, one place:
autoDetectInit(cwd, options)
- const projectConfig = await detectProjectConfig(cwd, undefined, options);
+ let problem: string | undefined;
+ const projectConfig = await detectProjectConfig(cwd, (_path, error) => { problem = error; }, options);
+ if (problem) throw new Error(describeUnreadableConfig(problem)); // as pull does: file, line, fix
…
Plus a test per representative caller (push, status, uninstall) with a broken partition config: exit 1, the file named, the user scope untouched.
Reproduction
- A user scope (
teamai init <team-url>in~) and a project scope (teamai init <other-team-url>in a git repo). - Corrupt the project's config (
~/.teamai/projects/<slug>/config.yaml, e.g.printf 'repo: [\n' > …). - In the project, run
teamai status(orpush,uninstall): it reports and acts on the user scope's team.
Environment
- OS: macOS 27.0
- Node.js: v24.21.0
- teamai:
mainat b3b3a0b0 - Provider: any
- AI tool(s): any
Logs
Where it was found
Found while fixing the same bug for the env commands in #880 (env set saved a token to the user team's store when the project config was unreadable; fixed there by passing an onUnreadable handler). This is the same fallback one layer down. Evidence here is from reading the code on main; the #880 fix has a real-CLI before/after for the env path.
- Dominant language
- TypeScript
- Stars
- 5k
- Forks
- 376
- Avg merge
- 13h 21m
- Merged PRs (30d)
- 288
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Tencent/teamai-cli
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Tencent/teamai-cli#893 ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 4/5 3-5 days Newbie friendliness 65/100
Tencent/teamai-cli#894 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Tencent/teamai-cli#884 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Tencent/teamai-cli#883 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Tencent/teamai-cli#882 ·
Maintainers usually reply within 1 day
All issues in Tencent/teamai-cli
Similar issues
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mermaid-js/mermaid-live-editor#2053 ·
Maintainers usually reply within 1 day
-
factory
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jessepollak/home#1455 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
lingdojo/kana-dojo#31227 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
appandflow/stim#1838 ·
Maintainers usually reply within 1 day