Skip to content

Commit 8794b9a

Browse files
author
Agent-Planner
committed
Apply CodeRabbit suggestions for PR AutoForgeAI#118
- Fix workflows to trigger on master branch instead of main - Protect DuckDNS cron file with chmod 600 (security fix) - Fix gemini_client.py to handle string delta.content in streaming - Fix scripts/deploy.sh to extract DuckDNS subdomain properly
1 parent a81515a commit 8794b9a

6 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Push CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [master]
66

77
jobs:
88
repo-guards:

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to VPS
33
on:
44
workflow_run:
55
workflows: ["Push CI"]
6-
branches: [main]
6+
branches: [master]
77
types:
88
- completed
99

.github/workflows/pr-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR Check
22

33
on:
44
pull_request:
5-
branches: [main]
5+
branches: [master]
66

77
permissions:
88
contents: read

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ configure_duckdns() {
169169
cat > "${cron_file}" <<EOF
170170
*/5 * * * * root curl -fsS "https://www.duckdns.org/update?domains=${DUCKDNS_SUBDOMAIN}&token=${DUCKDNS_TOKEN}&ip=" >/var/log/duckdns.log 2>&1
171171
EOF
172-
chmod 644 "${cron_file}"
172+
chmod 600 "${cron_file}"
173173

174174
# Run once immediately.
175175
curl -fsS "https://www.duckdns.org/update?domains=${DUCKDNS_SUBDOMAIN}&token=${DUCKDNS_TOKEN}&ip=" \

scripts/deploy.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ prompt_required DOMAIN "Enter your DuckDNS domain (e.g., myapp.duckdns.org)"
3030
prompt_required DUCKDNS_TOKEN "Enter your DuckDNS token"
3131
prompt_required LETSENCRYPT_EMAIL "Enter email for Let's Encrypt notifications"
3232

33+
# Extract subdomain for DuckDNS API (it expects just the subdomain, not full domain)
34+
if [[ "${DOMAIN}" == *.duckdns.org ]]; then
35+
DUCKDNS_SUBDOMAIN="${DOMAIN%.duckdns.org}"
36+
else
37+
DUCKDNS_SUBDOMAIN="${DOMAIN}"
38+
fi
39+
3340
read -r -p "Git repo URL [https://github.com/heidi-dang/autocoder.git]: " REPO_URL
3441
REPO_URL=${REPO_URL:-https://github.com/heidi-dang/autocoder.git}
3542

@@ -75,11 +82,11 @@ configure_duckdns() {
7582
echo "Configuring DuckDNS..."
7683
local cron_file="/etc/cron.d/duckdns"
7784
cat > "$cron_file" <<EOF
78-
*/5 * * * * root curl -fsS "https://www.duckdns.org/update?domains=$DOMAIN&token=$DUCKDNS_TOKEN&ip=" >/var/log/duckdns.log 2>&1
85+
*/5 * * * * root curl -fsS "https://www.duckdns.org/update?domains=$DUCKDNS_SUBDOMAIN&token=$DUCKDNS_TOKEN&ip=" >/var/log/duckdns.log 2>&1
7986
EOF
80-
chmod 644 "$cron_file"
87+
chmod 600 "$cron_file"
8188
# Run once immediately
82-
curl -fsS "https://www.duckdns.org/update?domains=$DOMAIN&token=$DUCKDNS_TOKEN&ip=" >/var/log/duckdns.log 2>&1 || true
89+
curl -fsS "https://www.duckdns.org/update?domains=$DUCKDNS_SUBDOMAIN&token=$DUCKDNS_TOKEN&ip=" >/var/log/duckdns.log 2>&1 || true
8390
}
8491

8592
clone_repo() {

server/gemini_client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ async def stream_chat(
7373
for choice in chunk.choices:
7474
delta = choice.delta
7575
if delta and delta.content:
76-
# delta.content is a list of content parts
77-
for part in delta.content:
78-
text = getattr(part, "text", None) or part.get("text") if isinstance(part, dict) else None
79-
if text:
80-
yield text
76+
# OpenAI SDK 1.52+ returns delta.content as a string
77+
if isinstance(delta.content, str):
78+
yield delta.content
79+
else:
80+
# Fallback for list-based content parts (older versions)
81+
for part in delta.content:
82+
text = getattr(part, "text", None) or (part.get("text") if isinstance(part, dict) else None)
83+
if text:
84+
yield text

0 commit comments

Comments
 (0)