memory-ingest stages inside GSTACK_HOME (gitignore=* repo) → gbrain git-aware import sees 0 files → silent false-success
- Dominant language
- TypeScript
- Stars
- 133k
- Forks
- 19.9k
- Avg merge
- 18h 46m
- Merged PRs (30d)
- 26
Description
## Summary
On a Supabase/Postgres + Windows setup, `gstack-memory-ingest` reports success but imports **0** transcript pages. Root cause is an interaction with gbrain v0.42's git-aware `import`.
## Mechanism
1. `makeStagingDir()` stages prepared pages under `$GSTACK_HOME` (`~/.gstack`), which is itself a git work tree with `.gitignore = *` (the gstack-artifacts repo).
2. gbrain v0.42 `import ` enumerates files via `collectSyncableFiles` → `gitListSyncableFiles`, which runs `git ls-files --cached --others --exclude-standard`. Inside a `.gitignore = *` tree this returns **zero** files.
3. gbrain prints `Found 0 markdown files`, imports 0, exits 0, emits valid `{"imported":0,...}` JSON.
4. `gstack-memory-ingest` sees exit 0 + parseable JSON → treats it as success → advances `.transcript-ingest-state.json`, marking every session ingested. Net: 0 transcript pages ever reach the brain, silently.
## Repro (side-effect-free)
```sh
mkdir -p ~/.gstack/.staging-ingest-X/transcripts && printf -- '---\ntitle: t\ntype: transcript\n---\nhi' > ~/.gstack/.staging-ingest-X/transcripts/x.md
git -C ~/.gstack/.staging-ingest-X ls-files --cached --others --exclude-standard # -> EMPTY
```
Same staged file in a non-git dir is found by gbrain's FS-walk fallback and imports fine.
## Suggested fix
- Stage outside any git work tree (e.g. an OS temp dir), or
- Assert `imported + skipped + errors == staged` before advancing ingest state (fail loud on the 0-of-N mismatch).
## Env
gstack 1.58.4.0, gbrain 0.42.42.0, Windows 10, Supabase Postgres engine.
Contributor guide
Research direction
Start at gstack-memory-ingest and its makeStagingDir() path, then trace how the gbrain import result is parsed before .transcript-ingest-state.json advances. Run the side-effect-free staging and git ls-files reproduction from the issue, and verify that a staged batch is either imported from outside the git work tree or that a 0-of-N result fails loudly instead of marking sessions ingested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, postgres, supabase, typescript
- Domain
- cli, databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100