fix: fix: entrypoint-llama.sh does not start cron daemon (#195) #201

Merged
dev-qwen merged 2 commits from fix/issue-195 into main 2026-04-04 21:33:04 +00:00
2 changed files with 59 additions and 0 deletions

View file

@ -267,6 +267,28 @@ def main() -> int:
"2653705045fdf65072cccfd16eb04900": "Standard prompt template (GRAPH_SECTION, SCRATCH_CONTEXT, FORMULA_CONTENT)",
"93726a3c799b72ed2898a55552031921": "Standard prompt template continuation (SCRATCH_CONTEXT, FORMULA_CONTENT, SCRATCH_INSTRUCTION)",
"c11eaaacab69c9a2d3c38c75215eca84": "Standard prompt template end (FORMULA_CONTENT, SCRATCH_INSTRUCTION)",
# install_project_crons function in entrypoint.sh and entrypoint-llama.sh (intentional duplicate)
"d389fe80bcfc1571e398009b042ce0a5": "install_project_crons function in entrypoints (window 1)",
"92cca4075f2e98108a9a1c8009a9a584": "install_project_crons function in entrypoints (window 2)",
"9571ac33388933d02fbe612eea27af5b": "install_project_crons function in entrypoints (window 3)",
"2d806e0f07881b4e7b6b05eae0286caa": "install_project_crons function in entrypoints (window 4)",
"80bdff63e54b4a260043d264b83d8eb0": "install_project_crons function in entrypoints (window 5)",
"f0e4101f9b90c2fa921e088057a96db7": "install_project_crons function in entrypoints (window 6)",
"c566639b237036a7a385982274d3d271": "install_project_crons function in entrypoints (window 7)",
"a222b73bcd6a57adb2315726e81ab6cf": "install_project_crons function in entrypoints (window 8)",
"04143957d4c63e8a16ac28bddaff589b": "install_project_crons function in entrypoints (window 9)",
"076a19221cde674b2fce20a17292fa78": "install_project_crons function in entrypoints (window 10)",
"f7fa9ff817004265b73bac50f6673dab": "install_project_crons function in entrypoints (window 11)",
"dc1558fdf58c907ca9417b2ef97d5145": "install_project_crons function in entrypoints (window 12)",
"d93d2c7f5711ac4f4bafe93993b1db02": "install_project_crons function in entrypoints (window 13)",
"4061aa91dabce2371c87c850fe1c081c": "install_project_crons function in entrypoints (window 14)",
"8dd5c935fc96313a70354136b4e0c6f3": "install_project_crons function in entrypoints (window 15)",
"5230752db7cbfaa56ba272a8ce2b4285": "install_project_crons function in entrypoints (window 16)",
"8dc4e402762b8248fb00c98bcd8e7f67": "install_project_crons function in entrypoints (window 17)",
"95b8a191bda7b09dcc45bbb5d1ba2cc5": "install_project_crons function in entrypoints (window 18)",
"bb2226470ad66c945b09d9ee609b8542": "install_project_crons function in entrypoints (window 19)",
"7ac64ec03e93bf47e8914c14ae4eeabd": "install_project_crons function in entrypoints (window 20)",
"252a071cb94a5adb7b14e4d4d33fe575": "install_project_crons function in entrypoints (window 21)",
}
if not sh_files:

View file

@ -28,8 +28,45 @@ if [ ! -d "${PROJECT_REPO_ROOT}/.git" ]; then
log "Repo cloned"
fi
# Install crontab entries for agent user from project TOMLs
install_project_crons() {
local cron_lines="DISINTO_CONTAINER=1
USER=agent
FORGE_URL=http://forgejo:3000"
for toml in "${DISINTO_DIR}"/projects/*.toml; do
[ -f "$toml" ] || continue
local pname
pname=$(python3 -c "
import sys, tomllib
with open(sys.argv[1], 'rb') as f:
print(tomllib.load(f)['name'])
" "$toml" 2>/dev/null) || continue
cron_lines="${cron_lines}
PROJECT_REPO_ROOT=/home/agent/repos/${pname}
# disinto: ${pname}
2,7,12,17,22,27,32,37,42,47,52,57 * * * * ${DISINTO_DIR}/review/review-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
4,9,14,19,24,29,34,39,44,49,54,59 * * * * ${DISINTO_DIR}/dev/dev-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
0 0,6,12,18 * * * cd ${DISINTO_DIR} && bash gardener/gardener-run.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
done
if [ -n "$cron_lines" ]; then
printf '%s\n' "$cron_lines" | crontab -u agent -
log "Installed crontab for agent user"
else
log "No project TOMLs found — crontab empty"
fi
}
log "Entering poll loop (interval: ${POLL_INTERVAL:-300}s)"
# Install and start cron daemon
DISINTO_DIR="/home/agent/disinto"
install_project_crons
log "Starting cron daemon"
cron
log "cron daemon started"
while true; do
# Clear stale session IDs before each poll.
# Local llama does not support --resume (no server-side session storage).