P9 G6 PF-07 Backup Path Investigation & v0.5 Proposal — 2026-04-27
title: P9 G6 PF-07 — Backup Path Investigation & v0.5 Proposal date: 2026-04-27 executor: Claude Code (medium effort) type: investigation-report status: proposal-pending-authorize
G6 PF-07 Backup Path Investigation — 2026-04-27
TL;DR
PF-07 v0.4 hard-stop với "rclone config section GDrive không tìm thấy" có hai root cause cộng dồn:
- Sai host context — PF-07 chạy trên Mac local (
nmhuyen@darwin), không có rclone config. Backup thực tế chạy trên VPS38.242.240.89(root). - Sai remote name — Trên VPS remote tên là
gdrive-backup:(lowercase, hyphenated), KHÔNG phảiGDrive.
Đề xuất PF-07 v0.5: SSH non-interactive vào VPS, dùng remote gdrive-backup:, freshness window theo từng loại backup (full daily=30h, code 4x/day=10h, pg daily=30h).
§1. Bước 1 — Execution Context
whoami: nmhuyen
host: Mac local (darwin 26.4.1, arm64)
HOME: /Users/nmhuyen
rclone: /opt/homebrew/bin/rclone v1.73.3
Phát hiện: Claude Code (và Codex trước đó) chạy trên Mac local, không phải VPS. Memory ghi rõ "VPS có GDrive backup" → backup orchestration nằm trên VPS, nên check rclone config local là sai context.
§2. Bước 2 — rclone Config (Mac local, metadata only)
rclone config file → /Users/nmhuyen/.config/rclone/rclone.conf (KHÔNG tồn tại)
rclone listremotes → empty (no config)
~/.config/rclone/ → empty dir
/etc/rclone/ → not present
Mac local KHÔNG có rclone config. Đúng kỳ vọng — Mac chỉ là dev workstation.
§3. Bước 3 — VPS Backup Infrastructure
SSH non-interactive (BatchMode=yes, key-based, không hỏi password) vào contabo (= 38.242.240.89, root) — kết nối thành công.
3.1 rclone config trên VPS (metadata only)
config file: /root/.config/rclone/rclone.conf (585 bytes, mtime 2026-04-27 15:00)
listremotes: gdrive-backup:
Chỉ có 1 remote duy nhất tên gdrive-backup:. Không có remote tên GDrive. Đây là root cause của PF-07 v0.4 hard-stop khi grep section [GDrive].
3.2 Backup orchestration (root crontab)
| Schedule (UTC) | Schedule (ICT) | Script | Mục đích |
|---|---|---|---|
0 20 * * * |
03:00 hằng ngày | /opt/incomex/scripts/backup-to-gdrive.sh |
Full VPS backup (1x/day) |
0 1,5,8,13 * * * |
08,12,15,20 (4x/day) | /opt/incomex/scripts/code-backup-to-gdrive.sh |
Code backup (4x/day) |
0 2 * * * |
09:00 ICT | /opt/incomex/scripts/pg-backup.sh |
PG dump (1x/day, local only) |
RCLONE_REMOTE="gdrive-backup:" confirmed trong cả 2 scripts gdrive (grep dòng assignment, không cat full).
3.3 Local backup paths trên VPS
| Loại | Path | Latest |
|---|---|---|
| VPS full | /opt/incomex/backups/vps-backup-*.tar.gz |
vps-backup-20260425_200002.tar.gz (110 MB, 2026-04-25 20:01 UTC) |
| Code | /opt/incomex/backups/code/{agent-data-test,web-test}/ |
mtime 2026-04-27 15:00 UTC |
| PG | /opt/incomex/backups/pg/directus_*.sql.gz |
directus_2026-04-27_0000.sql.gz (mtime 2026-04-27 02:00 UTC, size=20 bytes — anomaly) |
Anomaly tham khảo (out-of-scope investigation):
- Local có
vps-backup-20260426_200001/(directory, chưa tar) — full backup 2026-04-26 dường như chưa hoàn tất archive. directus_2026-04-27_0000.sql.gzchỉ 20 bytes — pg dump của 2026-04-27 có thể fail (so với 43 MB của ngày 04-26).
Hai anomaly này không thuộc scope PF-07; chỉ ghi nhận để Opus đánh giá riêng.
§4. Bước 4 — Backup Freshness (metadata only)
Current UTC: 2026-04-27 13:30.
4.1 Remote gdrive-backup: — VPS full backups
rclone lsl gdrive-backup: --max-depth 1 --include "vps-backup-*" → 5 file mới nhất:
| File | Size | mtime UTC |
|---|---|---|
| vps-backup-20260421_200002.tar.gz | 95 MB | 2026-04-21 20:00 |
| vps-backup-20260422_200002.tar.gz | 87 MB | 2026-04-22 20:01 |
| vps-backup-20260423_200001.tar.gz | 102 MB | 2026-04-23 20:01 |
| vps-backup-20260424_200003.tar.gz | 103 MB | 2026-04-24 20:01 |
| vps-backup-20260425_200002.tar.gz | 105 MB | 2026-04-25 20:01 |
Lag hiện tại: 2026-04-27 13:30 UTC − 2026-04-25 20:01 UTC = ~41h. Vượt window 30h kỳ vọng (24h schedule + 6h grace) → WARN, có thể liên quan anomaly 04-26 đang là directory chưa tar.
4.2 Remote — code backup folders (Vietnamese names)
rclone lsd gdrive-backup: --max-depth 1:
agent-data-test-backup fr VPS (folder)
web-test backup fr VPS (folder)
VPS Backup (folder)
⚠️ Tên folder có dấu cách + tiếng Việt — PF-07 phải quote đúng.
§5. PF-07 v0.5 Proposal
5.1 Acceptable backup evidence sources
| Source | Path | Window | Lý do |
|---|---|---|---|
| VPS full backup (remote) | gdrive-backup:vps-backup-YYYYMMDD_*.tar.gz (latest) |
≤ 30h | Cron 1x/day 20:00 UTC; 24h + 6h grace |
| VPS full backup (local) | /opt/incomex/backups/vps-backup-*.tar.gz (latest) |
≤ 30h | Same schedule, local copy fallback |
| PG backup (local) | /opt/incomex/backups/pg/directus_*.sql.gz (latest, size > 1KB) |
≤ 30h | Cron 1x/day 02:00 UTC |
| Code backup (remote) | gdrive-backup:agent-data-test-backup fr VPS/ mtime |
≤ 10h | 4x/day max gap ~8h + 2h grace |
Recommendation: PF-07 v0.5 chỉ cần verify VPS full backup remote (window 30h) là pass — đó là backup quan trọng nhất cho rollback Đ38.
5.2 Exact commands cho PF-07 v0.5
# Bước A: SSH non-interactive vào VPS
ssh -o BatchMode=yes -o ConnectTimeout=10 contabo 'rclone listremotes' \
| grep -qx 'gdrive-backup:' \
|| { echo "PF-07 FAIL: remote gdrive-backup: not configured on VPS"; exit 1; }
# Bước B: Lấy mtime của vps-backup mới nhất trên remote (UTC epoch)
LATEST_UTC=$(ssh -o BatchMode=yes contabo \
'rclone lsjson gdrive-backup: --max-depth 1 --include "vps-backup-*.tar.gz"' \
| jq -r 'sort_by(.ModTime) | last | .ModTime' \
| xargs -I{} date -u -d "{}" +%s)
# Bước C: Tính lag (giây)
NOW_UTC=$(date -u +%s)
LAG_SEC=$(( NOW_UTC - LATEST_UTC ))
LAG_HOURS=$(( LAG_SEC / 3600 ))
# Bước D: Window check (30h = 108000s)
if [ "$LAG_SEC" -gt 108000 ]; then
echo "PF-07 FAIL: VPS full backup lag ${LAG_HOURS}h > 30h window"
exit 1
fi
echo "PF-07 PASS: VPS full backup lag ${LAG_HOURS}h ≤ 30h"
Chỉ dùng rclone lsjson / rclone listremotes — KHÔNG rclone config show, KHÔNG cat rclone.conf, KHÔNG copy/sync/cat backup payload.
5.3 STOP conditions cho PF-07 v0.5
| # | Điều kiện | Hành động |
|---|---|---|
| 1 | SSH non-interactive fail (key chưa load, host unreachable) | STOP, report; KHÔNG fallback sang password |
| 2 | rclone listremotes không có gdrive-backup: |
STOP, report; remote bị đổi tên/xóa |
| 3 | rclone lsjson empty (không có file vps-backup-*) |
STOP, report; có thể quota Drive bị block |
| 4 | LAG > 30h | STOP, FAIL; không retry G6 cho đến khi human investigate (anomaly 04-26 hiện tại sẽ trip điều này) |
| 5 | jq không có trên runner |
STOP, install jq trước hoặc dùng --format |
5.4 Mutation budget
- DDL: ❌ none
- DML: ❌ none
- Schema: ❌ none
- Production state: ❌ none read-write
- Read-only: ✅ rclone metadata, SSH command exec read-only
PF-07 v0.5 = pure verification gate, không touch production.
§6. Recommendation cho G6 wrapper v0.6
- Replace PF-07 v0.4 (local
grep [GDrive] rclone.conf) bằng PF-07 v0.5 (SSH +rclone lsjsonmetadata, 30h window). - Pre-flight check trước khi chạy G6: SSH key
contabo_vpsđã load và non-interactive accessible. - Anomaly handling: vps-backup 2026-04-26 đang là directory chưa tar — nếu G6 dự tính chạy hôm nay, lag sẽ ~41h → PF-07 v0.5 sẽ FAIL đúng. Cần human investigate
/opt/incomex/scripts/backup-to-gdrive.shlog trước retry G6. - PG dump anomaly (20 bytes ngày 04-27): out-of-scope cho PF-07 nhưng cần ticket riêng.
§7. Compliance Confirm
- ✅ Read-only investigation
- ✅ KHÔNG
rclone config show/cat rclone.conf/ grep secret - ✅ KHÔNG download backup payload
- ✅ KHÔNG hỏi user password
- ✅ Chỉ
sudo -n(không cần dùng trong scope này) - ✅ Bounded
find(không quét/) - ✅ KHÔNG retry G6, KHÔNG bypass
- ✅ KHÔNG production mutation
- ✅ KHÔNG
git commit/git push
§8. Hand-off
Investigation complete. Chờ Opus orchestrator:
- Đọc report này
- Soạn G6 wrapper v0.6 với PF-07 v0.5 (commands ở §5.2)
- GPT R13 review
- User authorize
- Investigate anomaly vps-backup 2026-04-26 + pg dump 2026-04-27 (hai ticket riêng)
STOP HERE — không tự đề xuất retry G6, không patch wrapper.
Report soạn bởi Claude Code · 2026-04-27 · medium effort · PF-07 investigation chain GPT R12+R13 PASS