GPT Review — 20B-P1 Stop KB Upload Prompt rev1
GPT Review — 20B-P1 Stop KB Upload Prompt rev1
Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/prompts/20b-p1-stop-context-pack-kb-upload-prompt.mdrev1
Verdict
Direction PASS, but rev2 patch required before dispatch.
The prompt correctly limits scope to stopping future context-pack KB upload. It does not delete old KB docs, does not deindex, and does not touch cron/search API. Good.
However, a few execution-safety details need tightening.
Required patches
P1 — Do not blindly set kb_mirror_status = disabled/skipped
Prompt currently says:
Giữ nguyên
kb_mirror_statuscolumn update — đổi giá trị thànhdisabledhoặcskippedthay vìlive.
This is unsafe unless schema/check constraints allow those values. If kb_mirror_status is constrained, the script will fail or create invalid semantics.
Patch:
Before patching script, inspect allowed status values:
SELECT conname, pg_get_constraintdef(oid)
FROM pg_constraint
WHERE conrelid='context_pack_manifest'::regclass
AND pg_get_constraintdef(oid) ILIKE '%kb_mirror_status%';
SELECT DISTINCT kb_mirror_status
FROM context_pack_manifest
ORDER BY 1;
Then choose:
- If
skipped/disabledis already allowed → use one of those. - If not allowed → do not invent new status in 20B-P1. Leave manifest behavior unchanged or use an existing allowed neutral value, and record TD: “manifest semantics patch needed under Đ43/20C.”
The key goal of 20B-P1 is to stop KB upload, not solve manifest semantics.
P2 — Use exact backup path variable, no wildcard in diff
Prompt uses:
diff /opt/incomex/backups/dot-context-pack-build.sh.pre-20b-p1.* "$SCRIPT"
This can compare multiple old backups and confuse the report.
Patch:
Use one variable consistently:
BACKUP_PATH="/opt/incomex/backups/dot-context-pack-build.sh.pre-20b-p1.${TIMESTAMP}"
cp "$SCRIPT" "$BACKUP_PATH"
diff "$SCRIPT" "$BACKUP_PATH"
...
diff "$BACKUP_PATH" "$SCRIPT" | head -80
Report exact BACKUP_PATH.
P3 — Prefer reversible env flag, not comment-out
Option B comment-out is acceptable only if script structure makes flag patch unsafe.
Preferred patch shape:
KB_MIRROR_ENABLED="${KB_MIRROR_ENABLED:-false}"
Then wrap only the KB mirror upload block:
if [ "$KB_MIRROR_ENABLED" = "true" ]; then
... existing KB upload block ...
else
log_warn "7e KB mirror SKIPPED (disabled by 20B-P1; filesystem + PG manifest remain authoritative)"
fi
This is reversible without editing code again.
P4 — Add post-patch static proof that the upload block is gated
Current grep “0 active matches” may be unreliable because upload code can remain inside the gated branch.
Patch verification:
- Show
grep -n 'KB_MIRROR_ENABLED' "$SCRIPT". - Show the patched block context via grep/awk/sed using discovered line numbers.
- Confirm no unconditional
upload_document/createDocumentruns outside theKB_MIRROR_ENABLED=trueblock.
Do not require upload strings to disappear; they may remain inside the disabled branch.
P5 — Do not run the context-pack build script in 20B-P1
Prompt currently does not ask to run it, which is good. Make this explicit:
- No build execution.
- No cron execution.
- No service restart.
Only syntax/static verification.
P6 — Add partial report rule
If backup succeeds but patch or syntax check fails:
- restore from backup immediately;
- upload partial report with error;
- HARD STOP.
If backup fails:
- do not patch;
- upload partial report;
- HARD STOP.
Directive to Opus
Patch prompt to rev2 with P1–P6. Then it is ready to dispatch.
Boundaries remain
- no deleteDocument;
- no deindex;
- no bulk cleanup;
- no cron;
- no search API patch;
- no Đ43 patch;
- no service restart;
- no Pack 2C/IU.