KB-1B4B

06 — GPT Council Round 1 Review → Điều 45 v0.2 DRAFT Patch

11 min read Revision 1
dieu45-draftcouncil-reviewgpt-round-1patchv0.2event-vs-jobwork-state-machineexecutor-boundarymother-of-tasksilent-gapheartbeat

06 — GPT Council Round 1 Review → Điều 45 v0.2 DRAFT Patch

Date: 2026-05-26 Council round: GPT Round 1 — verdict received, patch applied same day. Law file: knowledge/dev/laws/dieu45-pg-native-queue-and-task-orchestration-law.md (revision 9, length grew ~6.3k chars). Status sau patch: v0.2 DRAFT — chờ Gemini Round 2 (optional theo Council policy) + User approval → BAN HÀNH v1.0. Mutation footprint: 100% law-drafting. Không DDL/DML/migration/event_outbox/Qdrant/production_documents/START-HERE/alias touch.


§1. GPT Council verdict tóm tắt

GPT Round 1 verdict: v0.1 directionally correct, DRAFT giữ nguyên — chưa BAN HÀNH.

§1.1 GPT giữ (keep)

  • Điều 45 là số luật đúng (không ép D44/D31/D35 nhận queue invariants).
  • Nguyên tắc PG-native first.
  • Quy tắc queue carries signal not data (§4).
  • PG 16.13 là đủ điều kiện; PG 18 KHÔNG là tiền điều kiện.
  • Customer-care / email / MOT là forward-compatible scope, không phải Phase-1 concrete schema.
  • KHÔNG đưa schema / job_outbox DDL vào trong luật.

§1.2 GPT yêu cầu patch (5 hạng mục)

# Tên Vị trí mới trong luật
P1 Event vs Job distinction §6.6 mới
P2 Work state machine invariant §6.7 mới
P3 Executor boundary clause §11.5 mới
P4 Mother of Task (MOT) clause strengthen §13.4 mới
P5 Silent gap / heartbeat / stale-worker observability invariant §15.5 mới

Cả 5 patch ĐÃ áp dụng ngày 2026-05-26 cho ra v0.2 DRAFT.


§2. Diff v0.1 → v0.2 chi tiết

§2.1 P1 — §6.6 Event vs Job distinction

Lý do: §1.2 v0.1 đã liệt kê 4 nhóm A/B/C/D nhưng KHÔNG nêu rõ event (fact bất biến) khác job (work với execution lifecycle). Hệ quả nguy hiểm: ai đó có thể đọc luật + thấy event_outbox live → kết luận "queue đã xong" trong khi nhóm D chưa có substrate.

Đã thêm:

  • Định nghĩa cứng event_vs_job (event = fact_that_happened; job = work_to_be_done).
  • 5 examples cho mỗi loại.
  • 5 rules — đáng chú ý: event_outbox_must_not_be_assumed_to_cover_all_job_queue_needs_without_job_layer.
  • 3 hệ quả luật: event_outbox là durable fact ledger không phải job queue; nhóm D đòi lifecycle riêng; cấm giả định "có outbox = có job queue" (anti-pattern A8').

Cross-link: §1.2, §6.7 (work state machine), §19 Q-D2 (job substrate decision), §17.1 (anti-patterns mở rộng).

§2.2 P2 — §6.7 Work state machine invariant

Lý do: v0.1 có staging_lifecycle (§6.2) và dot_iu_command_run.run_status (§6.3) nhưng chưa có state machine thống nhất cho job. GPT yêu cầu minimum 9 states.

Đã thêm:

  • work_state_machine.minimum_status = 9 trạng thái: queued / leased / in_progress / succeeded / failed / retry_waiting / dead_letter / cancelled / cleaned.
  • 6 rules — đáng chú ý: no_silent_state_change, no_untracked_work, state_transition_only_through_function_gate, private_executor_state_machine_bypassing_PG_is_forbidden.
  • Mối liên hệ vocab hiện hành: staging_lifecycle (data tier) khác work state machine (work tier); run_status là subset rút gọn — Council quyết định mở rộng trong DP2/DP3.

Cross-link: §6.2, §6.3, §8.3 lease, §8.4 dead-letter, §11.5 executor boundary, §15.5 silent gap, §17.1 anti-pattern A14'.

§2.3 P3 — §11.5 Executor boundary clause

Lý do: §11.1-11.4 v0.1 đã phân ranh Producer / Queue / Executor và có rules, nhưng chưa nêu rõ danh sách executor + 5 ràng buộc GPT yêu cầu.

Đã thêm:

  • Danh sách 8 executor: DOT / Agent / Hermes / Codex / PG_worker / external_worker / future_Kestra_adapter / future_MOT_executor.
  • 6 rules — đáng chú ý: queue_PG_is_source_of_truth, executor_must_not_hold_private_source_of_truth, executor_state_must_be_reconstructable_from_PG_after_restart, executor_must_register_healthcheck_per_§15.3_before_enable.
  • 4 hệ quả: ghi back trạng thái / kết quả / evidence; cấm private in-memory queue; reconstruct từ PG sau crash; cross-ref §11.2 + §15.5.

Cross-link: §11.1 ba lớp, §11.2 rules, §6.7 work state machine, §15.3 healthcheck contract, §15.5 silent gap.

§2.4 P4 — §13.4 Mother of Task (MOT) clause

Lý do: §13.3 v0.1 nêu MOT "không Phase 1" như design seam, nhưng GPT yêu cầu strengthen quan hệ luật để mọi MOT sub-design pack tương lai bị ràng buộc TRƯỚC khi spec ổn định.

Đã thêm:

  • mother_of_task_clause yaml:
    • role: generate_workflow_instances_from_template_or_config
    • 7 relation_to_queue: MOT_emits_job_graph / queue_orchestrates_steps / each_step_may_be_an_information_unit / trigger_in_trigger_out_go_through_queue / MOT_itself_is_not_an_executor / MOT_instance_state_lives_in_PG / MOT_step_lifecycle_follows_work_state_machine.
  • 4 hệ quả: KHÔNG bypass queue; trigger-in/out qua queue; MOT step có thể là IU nhưng KHÔNG bypass Điều 37/35; runtime substrate là sub-design pack riêng.

Lưu ý quan trọng: clause này strengthen quan hệ luật chứ KHÔNG ban hành substrate MOT. Phase 1 vẫn KHÔNG có table MOT. Đây vẫn là design seam nhưng từ v0.2 trở đi mọi nỗ lực mở MOT phải tuân clause này.

Cross-link: §13.1-13.3, §6.7 work state machine, §11.5 executor (future_MOT_executor), §12 trigger-in/out, §3 không có luật riêng cho IU, Điều 37 cut alias, Điều 35 DOT.

§2.5 P5 — §15.5 Silent gap / heartbeat / stale-worker invariant

Lý do: §15.4 v0.1 đã có liveness contract (cadence rule + event-emit) và §20.4 acknowledge silent gap thực tế (iu_outbound_default 4-day gap). Nhưng silent gap chưa được nâng thành violation. GPT yêu cầu nâng cấp.

Đã thêm:

  • runtime_observability.required (5 items): worker_heartbeat / cursor_last_run_at / stale_threshold / stale_worker_healthcheck / dead_letter_visibility.
  • 6 rules — đáng chú ý: silent_gap_is_a_health_violation, dlq_growth_must_be_observable_without_querying_internal_tables, no_executor_may_run_without_registered_healthcheck, silent_gap_must_be_attributable_to_a_named_executor_per_§11.5.
  • 5 hệ quả: silent worker = violation; DLQ phải có view mở; healthcheck là gate ban hành; cross-ref §15.4 + §11.5 + §6.7; §20.4 vẫn áp dụng cho period chuyển tiếp (gap đã có không bị truy cứu ngược).

Cross-link: §15.3 healthcheck contract, §15.4 cadence + event-emit, §20.4 transitional, §11.5 executor boundary, §6.7 work state machine.


§3. Verification block diff

v0.1 verification block:

phase_status=DRAFT
version=v0.1
council_approved=false
…
next_required_pack=DIEU45_COUNCIL_REVIEW_ROUND_1

v0.2 verification block (đã patch):

phase_status=DRAFT
version=v0.2
council_round_1_gpt_approved=true
council_round_2_gemini_approved=false
council_approved=false
…
event_vs_job_distinction=explicit_§6.6
work_state_machine_invariant=explicit_§6.7_min_9_states
executor_boundary_clause=explicit_§11.5
mother_of_task_clause=explicit_§13.4
runtime_observability_silent_gap_rule=explicit_§15.5
gpt_council_round_1_patch=applied_2026-05-26
next_required_pack=DIEU45_COUNCIL_REVIEW_ROUND_2_GEMINI_OR_USER_APPROVAL

§4. Cái KHÔNG thay đổi (preserved compatibility)

  • Cấu trúc 22 sections — KHÔNG renumber. Mọi patch là subsection mới dưới section đã có.
  • Vocab §6.1 (9-domain × 7-stream × 2-lane × 3-severity × 2-classification) — KHÔNG đụng.
  • Vocab §6.2 staging lifecycle 7-state — KHÔNG đụng.
  • Vocab §6.3 DOT run-mode/run-status — KHÔNG đụng.
  • §14 NVSZ 4-layer guarantee — KHÔNG đụng.
  • §16 compatibility matrix với Điều 30/31/35/36/37/44 — KHÔNG đụng.
  • §17 14 hard-reject + 3 soft-warn anti-patterns — KHÔNG xoá; chỉ thêm reference A8'/A14' trong §6.6/§6.7 (chưa tăng count anti-pattern trong §17 chính thức — Council có thể đề nghị nâng count trong Round 2).
  • §18 ky luật triển khai + 7 sub-design packs — KHÔNG đụng.
  • §19 21/28 open questions — KHÔNG đụng.
  • §20 transitional clause — KHÔNG đụng.

Cross-reference với các luật hiện hành (D22/D28/D29/D30/D31/D32/D35/D36/D37/D39/D43/D44): KHÔNG amend luật nào.


§5. Cái Claude không tự thêm trong patch này

Các đề xuất Claude không tự đưa vào luật v0.2 (chờ Council quyết):

  1. Bumping anti-pattern count §17 từ 14 → 16 (vì có A8' và A14' mới). Để Round 2 / User quyết có chính thức hoá.
  2. Concrete max_attempts number — vẫn ở DP3.
  3. Concrete stale_threshold multiplier (chỉ ghi "vd 3×" như §15.4). DP3 sẽ chốt.
  4. MOT runtime schema — vẫn là sub-design pack riêng khi MOT spec ổn.
  5. DDL cho job substrate — vẫn ở DP2.

Mọi điều trên thuộc Council + sub-design pack process.


§6. KB upload verification

Sau patch (2026-05-26):

File Status Revision
…/dieu45-pg-native-queue-and-task-orchestration-law.md patched 9
…/v0.6-dieu45-pg-native-queue-law-draft/06-gpt-council-review-patch-v0-2.md uploaded (this file) 1
…/00-summary.md refresh v0.2 marker (next)
…/03-compatibility-matrix.md minor cross-ref add (next)
…/04-open-questions-before-design.md minor cross-ref add (next)
…/05-next-design-backlog.md minor cross-ref add (next)

Search keys must return positive (Council verify):

  • "event vs job"
  • "work state machine"
  • "executor boundary"
  • "Mother of Task"
  • "silent gap"
  • "heartbeat"
  • "queue carries signal not data"
  • "PG16.13"
  • "PG18 not prerequisite"

§7. Risk register (post-patch)

Risk Probability Severity Mitigation
Gemini Round 2 yêu cầu nâng anti-pattern count §17 → 16 chính thức Medium Low Easy patch v0.3 — add 2 rows + update verification block
Council yêu cầu di chuyển §6.6/§6.7 sang §2 (định nghĩa) Low Low Easy patch — move subsections
User reject §13.4 vẫn quá mềm Medium Medium Patch v0.3 codify một số vocab MOT speculative
User reject §15.5 quá nghiêm (silent gap = violation) Low Medium Bổ sung transitional clause cụ thể trong §20 cho period chuyển tiếp
Gemini yêu cầu thêm succeeded_cleaned/dlq_cleaned chính thức trong §6.7 Low Low Đã có "cleaned" gốc; refine vocab nếu Council quyết

§8. Next step

  1. (Optional) Gemini Council Round 2 review v0.2.
  2. User approve v0.2 (hoặc yêu cầu patch v0.3).
  3. Ban hành Điều 45 v1.0.
  4. Dispatch DP1–DP7 theo §18.4 + §19 open Q.
  5. Cập nhật architecture index + cross-reference D36/D44 design docs.
  6. MEMORY.md cập nhật v0.2 status.

§9. Mutation footprint declaration

PATCH_DIEU45_QUEUE_LAW_V0_2_GPT_COUNCIL_REVIEW thực hiện:

  • ✅ Patch 9 lần vào law file (revision 1 → 9).
  • ✅ Upload 1 report mới (this file).
  • (Pending) Refresh 4 reports cũ (00/03/04/05).
  • ❌ KHÔNG DDL.
  • ❌ KHÔNG DML production.
  • ❌ KHÔNG migration.
  • ❌ KHÔNG install pg_cron.
  • ❌ KHÔNG upgrade PostgreSQL.
  • ❌ KHÔNG đụng event_outbox / Qdrant / production_documents.
  • ❌ KHÔNG đụng START-HERE / mark-cut alias.

Mọi mutation là KB document update — không production substrate.


06 — GPT Council Round 1 Review → Điều 45 v0.2 DRAFT Patch | 2026-05-26 | Claude Opus 4.7 (1M) | Council Round 1 đã pass; Round 2 + User approval pending.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-dieu45-pg-native-queue-law-draft/06-gpt-council-review-patch-v0-2.md