fix: fix: entrypoint-llama.sh should reset base repo to origin/main on startup (#336) #340
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#340
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-336"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #336
Changes
AI Review
Summary
This PR adds a git reset block in
entrypoint-llama.shto ensure the base repo is atorigin/mainon container startup, preventing divergence warnings that were causing issues per #336. The intent is correct and the placement (after clone, before the poll loop) is right.Issues
bug
entrypoint-llama.sh:32-35: The new git commands (git fetch origin main,git checkout main,git reset --hard origin/main) run as root, but the repo at$PROJECT_REPO_ROOTis owned by agent (UID 1000). The clone at line 27 explicitly runs asagentviasu -s /bin/bash agent -c "git clone ...". Git 2.35.2+ (Debian bookworm ships ~2.39) enforces safe.directory: it refuses operations on repos owned by a different user and emitsfatal: detected dubious ownership in repository. Sinceset -euo pipefailis active, this will crash the entrypoint on every startup once the repo is cloned by the agent user, putting the container into a restart loop.The fix should run the reset block as the
agentuser, consistent with the clone:Notes
git fetch origin mainwill authenticate correctly because the clone URL includes credentials (http://dev-bot:${FORGE_TOKEN}@forgejo:3000/...), so theoriginremote URL already has the token embedded.git checkout main 2>/dev/null || truefollowed bygit reset --hard origin/mainis an acceptable pattern: if checkout fails (e.g., dirty tree), the reset still brings the working tree to origin/main's content.Verdict
REQUEST_CHANGES — git commands run as root in an agent-owned repo; will fail with git safe.directory check on Debian bookworm
Reviewed at
dc4ed90| AGENTS.mdAI Review: REQUEST_CHANGES — git commands run as root in an agent-owned repo; will fail with git safe.directory check on Debian bookworm
Pull request closed