publish/sync fail with COMMIT_FAILED when the friction log is in a git-ignored directory
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- git, typescript
- Domain
- cli
Research direction
The failure is in add in src/Git.ts, which runs git add -- <paths> on paths that may be git-ignored. The proposed fix adds a helper that runs git check-ignore --no-index and filters those paths out before staging, returning early if none remain. Start by reading add and commit in src/Git.ts, then write a test in a temp repo that ignores **/.agents/*. Done when Git.add resolves without staging ignored files, Git.commit returns false, and a non-ignored path is still staged.
Written by the indexing model from the issue text.
Description
publish and sync stage the entries they touched with git add -- <paths>. When the friction log lives in a git-ignored directory (for example .agents/friction-log/ under a .agents/* ignore rule), git add exits non-zero, and the command returns COMMIT_FAILED after the issues were already filed and the entries marked linked.
Seen with frog 1.1.0.
Proposed fix
Git.add drops paths that git check-ignore --no-index reports before it stages anything, and returns early when nothing is left. --no-index matches how git add walks the working tree: it refuses a path under an excluded directory even when that path is tracked.
diff --git a/src/Git.ts b/src/Git.ts
index e395e6a399e3f38efe537509ac421680bb8da18b..0612d749cf3375ab5f1ea404b15889fbee5aaf1c 100644
--- a/src/Git.ts
+++ b/src/Git.ts
@@ -137,13 +137,39 @@ export async function changedSince(
}
/**
- * Stages paths.
+ * Paths the repository's ignore rules exclude.
+ *
+ * `--no-index` matches how `git add` traverses the working tree: it refuses a path under an
+ * excluded directory even when that path is tracked. The index-aware default disagrees there, so it
+ * would leave the very failure this guards against. The cost is a tracked file matching a
+ * file-level rule, which `git add` would accept and this reports as excluded - a contradictory
+ * configuration, and one worth skipping rather than failing over.
+ *
+ * @param files - Repository-relative paths.
+ * @returns The subset the ignore rules exclude. Empty when git cannot answer.
+ */
+async function ignored(files: readonly string[], options: Options = {}): Promise<Set<string>> {
+ // Exit 1 means nothing matched; any other failure is treated the same way, leaving `add` to
+ // surface the real error.
+ const output = await git(['check-ignore', '--no-index', '--', ...files], options).catch(() => '')
+ return new Set(output ? output.split('\n') : [])
+}
+
+/**
+ * Stages paths, skipping the ones git ignores.
+ *
+ * A friction log kept in an ignored directory is still a complete publish: the entries are filed
+ * and marked linked, and there is nothing left to commit. Staging them would fail the whole command
+ * over paths the repository has deliberately excluded.
*
* @param files - Repository-relative paths. An empty list is a no-op.
*/
export async function add(files: readonly string[], options: Options = {}): Promise<void> {
if (files.length === 0) return
- await git(['add', '--', ...files], options)
+ const excluded = await ignored(files, options)
+ const staged = files.filter((file) => !excluded.has(file))
+ if (staged.length === 0) return
+ await git(['add', '--', ...staged], options)
}
/**
Suggested test
A repo that ignores **/.agents/* with an entry under .agents/friction-log/<id>/friction.md. Git.add resolves without staging, Git.commit returns false, and a path that is not ignored is still staged.
Happy to open a PR with this change and the test if that helps.
- Dominant language
- TypeScript
- Stars
- 267
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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 wevm/frog
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
frog log rejects Windows repository rootsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
GitHub App token fallback misses recent issues in large repositoriesPossibly taken @blalor claimed this 56 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 68/100
-
feat: allow local log entries to select an issue formPossibly taken @emmajam claimed this 72 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
aws/agentcore-cli#2606 ·
Maintainers usually reply within 1 day
-
ai-driven-qa bug Cosmetic
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
ai-driven-qa bug claude Minor
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
linagora/twake-mail-admin#301 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
reproduced
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anomalyco/opencode#56038 · 1 comment ·
Maintainers usually reply within 1 day