docs: upstream multi-session safety, troubleshooting, and config examples#76
Conversation
…ples - Add git safe-commit pattern for concurrent session environments - Add submodule update warning before pre-commit hooks - Add troubleshooting section (pre-commit, imports, context, submodule) - Add [plugins], [env], and [mcp] config examples to gptme.toml - Add `make help` target to list available commands
|
@greptileai review |
Greptile SummaryThis PR upstreams several production-tested patterns from a 1700+ session workspace into the template, making it more robust for concurrent multi-agent usage and easier to onboard into.
One portability note: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant S1 as Session 1 (autonomous)
participant S2 as Session 2 (operator)
participant FL as flock (commit.lock)
participant PK as prek (pre-commit runner)
participant GI as .git/index
S1->>FL: git safe-commit — acquire lock
FL-->>S1: lock acquired
S1->>GI: git add file1.py
S1->>PK: run pre-commit hooks
PK->>GI: stash unstaged changes
Note over S2,FL: S2 tries to commit concurrently
S2->>FL: git safe-commit — acquire lock (blocked, timeout=60s)
FL-->>S2: waiting...
PK-->>GI: restore stashed changes
S1->>GI: git commit
S1->>FL: release lock
FL-->>S2: lock acquired
S2->>GI: git add file2.py
S2->>PK: run pre-commit hooks (safe, no index conflict)
S2->>GI: git commit
S2->>FL: release lock
Reviews (2): Last reviewed commit: "fix(template): add bin/git-safe-commit a..." | Re-trigger Greptile |
Addresses Greptile P2: git safe-commit was referenced without providing the actual script. Added bin/git-safe-commit (flock-based wrapper) and clarified that bin/ must be in PATH. Co-authored-by: Bob <bob@superuserlabs.org>
Greptile review addressedP2 (git safe-commit not in template) — Fixed in a8c4adf:
P1 (empty
|
|
@greptileai review |
| LOCKFILE="$GIT_DIR/commit.lock" | ||
|
|
||
| # Serialize commits with 60s timeout (prek hooks can take ~30s) | ||
| exec flock --timeout 60 "$LOCKFILE" git commit "$@" |
There was a problem hiding this comment.
flock is Linux-only — not available on macOS by default
flock is part of util-linux and is not installed on macOS out of the box. Developers working on this template from a Mac (or running the CI on macOS) will see flock: command not found and the script will fail completely.
Consider adding a guard at the top that provides a meaningful error message:
| exec flock --timeout 60 "$LOCKFILE" git commit "$@" | |
| if ! command -v flock &>/dev/null; then | |
| echo "error: 'flock' is required but not found (Linux: util-linux; macOS: brew install util-linux)" >&2 | |
| exit 1 | |
| fi | |
| # Serialize commits with 60s timeout (prek hooks can take ~30s) | |
| exec flock --timeout 60 "$LOCKFILE" git commit "$@" |
Alternatively, add a note in the script header documenting the dependency on Linux.
Summary
git safe-commitpattern for concurrent session environments (flock-based wrapper prevents prek stash/restore race conditions)[plugins],[env], and[mcp]sections togptme.tomlso agents can see what's availablemake helptarget: Lists all available Makefile targets with descriptionsAll patterns upstreamed from Bob's production workspace (1700+ sessions).
Test plan
make helpoutput is formatted correctly