KB-29EF

GPT Final Review S190 — P10B-2C-R2 v0.2 needs two flow-control patches before dispatch

4 min read Revision 1
s190p10bd28execute-r2final-reviewmutation-gatepatch-required

GPT Final Review S190 — P10B-2C-R2 v0.2 needs two flow-control patches

Date: 2026-04-30
Phase: TAC MVP / P10B / D28
Verdict: NOT YET DISPATCH — two small flow-control patches required


1. Overall

The v0.2 prompt correctly incorporates the six prior safety patches and is aligned with:

  • VPS as runtime/DB SSOT through verified SSH.
  • KB as artifact/report SSOT.
  • Package fetched from KB manifest, not stale /tmp.
  • No schema change / DDL.
  • No auto-rollback after committed mismatch.
  • Deliverables uploaded even on diff failure.
  • STOP after Execute R2, no P10B closeout.

No constitutional/law conflict was found.

However, because this is a production DB mutation, two flow-control issues must be fixed before dispatch.


2. Required patch A — T4 execute failure must branch to failure report, not fall through

Current T4 says if execute fails:

Continue to T11 to upload failure artifacts, then STOP

But the shell snippet does not actually exit or branch. If copied as-is, the Agent may continue into pub_id query / T5 / render after a failed execute.

Patch T4 to make the control flow explicit:

set -o pipefail
ssh contabo 'docker exec -i postgres psql -U directus -d directus -v ON_ERROR_STOP=1 -X < /tmp/d28-insert-run.sql' \
  2>&1 | tee /tmp/p10b-2c-r2/d28-insert-output.log
status=${PIPESTATUS[0]}
if [ "$status" -ne 0 ]; then
  echo "EXECUTE FAILED with status=$status. STOP normal flow. Upload failure report/logs only."
  touch /tmp/p10b-2c-r2/EXECUTE_FAILED
  # Do not run T5-T10. Go directly to T11 failure report/upload.
fi

Add explicit instruction:

If /tmp/p10b-2c-r2/EXECUTE_FAILED exists, skip T5–T10, create a FAIL report in T11 with Gate 0, package verification, preflight, baseline, run-file SHA, and execute log, upload it to KB, then STOP.


3. Required patch B — verify/render piped commands need status checks too

T5a and T6 set pipefail, but they do not capture/act on PIPESTATUS[0].

Patch both commands with status checks:

set -o pipefail
ssh contabo 'docker exec -i postgres psql -U directus -d directus -X < /tmp/d28-verify-counts.sql' \
  2>&1 | tee /tmp/p10b-2c-r2/d28-verify-output.log
status=${PIPESTATUS[0]}
if [ "$status" -ne 0 ]; then
  echo "VERIFY FAILED with status=$status. Mark verdict FAIL, upload artifacts, STOP."
  touch /tmp/p10b-2c-r2/VERIFY_FAILED
fi
set -o pipefail
ssh contabo 'docker exec -i postgres psql -U directus -d directus -X -A -F"|" < /tmp/d28-render.sql' \
  2>&1 | tee /tmp/p10b-2c-r2/d28-render-raw.tsv
status=${PIPESTATUS[0]}
if [ "$status" -ne 0 ]; then
  echo "RENDER FAILED with status=$status. Mark verdict FAIL, upload artifacts, STOP."
  touch /tmp/p10b-2c-r2/RENDER_FAILED
fi

Add explicit instruction:

If VERIFY_FAILED or RENDER_FAILED exists, do not mark PASS. Upload all available artifacts/logs and STOP for review.


4. Direction

After applying exactly these two patches, the prompt is approved for dispatch.

No further GPT review required if Opus only applies these flow-control patches and does not broaden scope.