You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] tags add overwrites a tags.yaml it cannot read, and tag refusals exit 0 #2046
Two ways a tag command mishandles a tags.yaml it cannot read:
teamai tags add replaces the file with a new one holding only the tags just added, silently dropping every tag the team had.
teamai tags remove and the empty-tag refusals print ✖ but exit 0, so a script or CI job reads the refusal as success.
Steps to reproduce
On main at 6911c22 (Windows 11, Node v22.19.0), in a project whose team repo holds a malformed tags.yaml:
$ printf 'skills: [unclosed\n' > team/tags.yaml
$ teamai tags add skills deploy backend
⚠ Failed to parse tags.yaml: Flow sequence in block collection must be sufficiently indented and end with a ] ...
✔ Set skills/deploy tags: backend
$ cat team/tags.yaml
skills:
deploy:
- backend
rules: {}
The old tag table is gone. A tags.yaml whose document is a scalar (just-a-scalar) is even quieter: loadTagsConfig returns null without a warning, and tags add still overwrites it.
$ teamai tags remove skills deploy backend # team repo has no tags.yaml
✖ No tags.yaml found in team repo.
$ echo $?
0
Expected
tags add refuses when tags.yaml exists but does not parse, naming the file and leaving it byte-for-byte unchanged.
tags remove says the file could not be read (not that it is missing) and exits 1 on that refusal, and also exits 1 when the file is missing.
The empty-tag refusals in tags subscribe, tags unsubscribe, tags add and tags remove exit 1, as the other tag refusals in the same command already do (tags remove on an unknown tag is a no-op, not a refusal).
tags list is unchanged in this issue.
Cause
loadTagsConfig (src/utils/tags.ts) returns null both for a missing file and for one that does not parse; tagsAdd treats null as "start a new file", so it writes over the unreadable one.
The refusal paths in src/tags.ts call log.error(...) and return without setting process.exitCode.
Fix
In tagsAdd, when the load returns null and tags.yaml exists, report that it could not be read and stop with exit 1; only a missing file starts a new table.
In tagsRemove, distinguish "could not be read" from "not found" with pathExists, and set exit 1.
Set process.exitCode = 1 on the empty-tag refusals.
Activity
fix(tags): keep an unreadable tags.yaml and exit 1 on refused tag com…
fix(tags): report a tags.yaml that cannot be read instead of a missin…
fix(tags): report a tags.yaml that cannot be read instead of a missin…