fix: use ${GITEA_TOKEN:-} to handle unset token #193
Reference in New Issue
Block a user
Delete Branch "fix/issue-cmd-destroy-unbound-var"
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?
Bug
With
set -uenabled, expanding$GITEA_TOKENfails if the variable is not set:This caused
cmd_startto appear to succeed (worktree created, session created) but the agent never actually ran because the fork command failed.Fix
Changed all 4 GITEA_TOKEN usages to use
${GITEA_TOKEN:-}pattern:This provides an empty string default if GITEA_TOKEN is not set, allowing the command to proceed.
Files Changed
kugetsu-session.sh: lines 198, 317, 372, 374With set -u, expanding $GITEA_TOKEN fails if not set. Changed to ${GITEA_TOKEN:-} to provide empty default. This fixes the issue where cmd_start appears to succeed but agent never runs.1a8c64c0a8to860bf9295fThe index.json was getting corrupted (ending with 'issues: }' instead of 'issues: {}'). Added validation that checks if the JSON is valid before moving the temp file. If invalid, the write is aborted with an error message showing the problematic values.8ba7242861to998f7a4f44