GPT Directive to Opus — P3D Pack1 Phase5C1 rev3 Advisory Lock Logged Execution
GPT Directive to Opus — P3D Pack 1 Phase 5C1 rev3 Advisory Lock + Logged Execution
Date: 2026-05-11 Issuer: GPT-5.5 Thinking / Incomex Hội đồng AI Receiver: Opus 4.7 Mode: PATCH 5C1 PROMPT ONLY — no execution
0. Verdict
5C1 rev2 is transaction-safe but not yet dispatch-approved. Patch to rev3 to add concurrency guard and mandatory execution logging.
Open:
P3D_PACK1_PHASE5C1_REV3_ADVISORY_LOCK_AND_LOGGED_EXECUTION
1. Required reading
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-p3d-pack1-phase5c1-rev2-candidate-not-approved-advisory-lock-log-2026-05-11.md
knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase5c1-species-mapping-qt001-backfill-prompt-DRAFT.md
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase5c1-rev2-transaction-safe-patch-report.md
2. Target outputs
Patch prompt in place:
knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase5c1-species-mapping-qt001-backfill-prompt-DRAFT.md
Create patch report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase5c1-rev3-advisory-lock-log-patch-report.md
3. Required rev3 fixes
3.1 Add mandatory execution log
Before any DB action, require full execution logging to a VPS path such as:
/opt/incomex/logs/p3d-pack1-phase5c1-<timestamp>.log
The log must capture:
- schema introspection output;
- precommit target capture;
- transaction start;
- advisory lock acquisition;
- captured_species_id;
- captured_mapping_id;
- committed backfill ids;
- COMMIT/ROLLBACK outcome;
- report upload status.
3.2 Add transaction-scoped advisory lock
Inside transaction, before stale-sensitive rechecks:
SELECT pg_advisory_xact_lock(hashtext('p3d_pack1_phase5c1_information_unit_species_mapping_backfill'));
or equivalent transaction-scoped advisory lock.
The lock string is approved as a pack-scope execution constant.
If advisory lock cannot be acquired or the function is unavailable, STOP and report. Do not continue without lock.
3.3 Add report flags
Add report fields:
advisory_lock_acquired=true|false
advisory_lock_key=p3d_pack1_phase5c1_information_unit_species_mapping_backfill
execution_log_path=<path>
execution_log_contains_committed_keys=true|false
kb_report_upload_status=success|failed
rollback_reference_available=kb|vps_log|both|none
3.4 Clarify rollback reference fallback
If COMMIT succeeds but KB upload fails:
- if VPS log has committed rollback keys → status may be
PARTIAL_LOGGED, not FAIL; - if neither KB nor VPS log has committed rollback keys → critical failure, immediately report to GPT/User.
3.5 Do not change content decisions
Do not change species identity, transaction steps, or scope.
4. Hard boundaries
- No Agent dispatch.
- No DB write.
- No seed/backfill execution.
- No migration.
- No DDL.
- No function/trigger patch.
5. Expected Opus response
Return only:
- Patched 5C1 prompt path.
- Patch report path.
- Top 5 rev3 fixes.
- Confirmation GPT final review + User GO required before Agent dispatch.
6. Status
phase5c1_rev3_patch_allowed=true
agent_dispatch_allowed=false
seed_allowed=false
backfill_allowed=false
migration_allowed=false