KB-3C81

Phase 3 — Queue job sequence (6 jobs, all succeeded)

6 min read Revision 1
dieu45phase3queuejob-sequencefn-job-enqueuefn-job-claimfn-job-ack2026-05-26

Phase 3 — Queue job sequence

pilot_run_id = bf3e6f4d-12e1-40b6-9345-3880ada69c22 lease_owner = actor = dieu45-phase3-pilot-2026-05-26

1. Enqueue (signal-only payloads)

All 6 jobs enqueued via fn_job_enqueue after queue.job_substrate.enabled was flipped ON for the pilot. Payloads carry signals only (no document body / vector / secret). The cut_manifest, mark_report, and coverage_proof content lives in iu_core.iu_staging_payload, not in the queue.

job_id job_kind idempotency_key
653428dc-a9b9-42e7-b7b6-848c5f94ae16 cut.copy_to_staging dieu45-phase3-pilot-dieu37-20260526-write-channel:copy_to_staging
338339bd-1bcb-4adb-962c-0ec94cfe119a cut.mark …:mark
dd76b57e-6ebc-4d87-b397-22e230d9cce5 cut.verify_mark …:verify_mark
cea9c99c-1b11-4262-81ca-d16eb95e99e2 cut.cut …:cut
8c1b025c-b71c-4ff0-aaf8-a317de8aa4b8 cut.verify_cut …:verify_cut
7d2f325a-81de-48a0-9474-405b3fb38882 cut.cleanup_checkpoint …:cleanup

Every row carries priority=50, actor='dieu45-phase3-pilot-2026-05-26', run_id=bf3e6f4d…, source_ref='knowledge/dev/laws/dieu37-governance-organization-law.md'. Payload examples:

  • cut.copy_to_staging: {"phase":"copy_to_staging","pilot":"dieu45_phase3","source_ref":"…","source_path":"/tmp/dieu37_source.txt","pieces_path":"/tmp/dieu37_pieces.json","expected_piece_count":17}
  • cut.cut: {"phase":"cut","pilot":"dieu45_phase3","apply":true,"open_composer":true}
  • cut.cleanup_checkpoint: {"phase":"cleanup_checkpoint","pilot":"dieu45_phase3","older_than_days":15,"dry_run":true}

No payload carries body, content, raw, vector, embedding, secret, token, password, ssn, or personal_data (§4 denylist of Điều 45 v1.0).

2. Claim → Execute → Ack lifecycle

# job_kind picked_at finished_at attempts state invocation
1 cut.copy_to_staging 15:13:49.443323+00 15:13:49.451623+00 0 succeeded input-readiness gate (no alias call)
2 cut.mark 15:13:49.457762+00 15:13:49.495209+00 0 succeeded fn_iu_op_mark_file(...)staging_record_id=258c715c…
3 cut.verify_mark 15:13:49.498471+00 15:13:49.511342+00 0 succeeded fn_iu_op_verify_mark(..., approve=true)verdict=approved
4 cut.cut 15:13:49.514123+00 15:17:39.183286+00 0 succeeded fn_iu_op_cut(..., apply=true, open_composer=true)cut_run_id=a64340fe… (after in-place payload patch for 3 section_types — same lease)
5 cut.verify_cut 15:17:39.186976+00 15:17:39.237461+00 0 succeeded fn_iu_op_verify_cut(run_id)verdict=verified
6 cut.cleanup_checkpoint 15:17:39.28717+00 15:17:39.371301+00 0 succeeded fn_iu_op_cleanup_dry_run(older_than_days=15)eligible_count=0, apply=false

last_error is NULL on every row.

3. Backlog snapshot

        job_kind        |   state   | row_count | avg_attempts | max_attempts_seen
------------------------+-----------+-----------+--------------+-------------------
 cut.cleanup_checkpoint | succeeded |         1 |         0.00 |                 0
 cut.copy_to_staging    | succeeded |         1 |         0.00 |                 0
 cut.cut                | succeeded |         1 |         0.00 |                 0
 cut.mark               | succeeded |         1 |         0.00 |                 0
 cut.verify_cut         | succeeded |         1 |         0.00 |                 0
 cut.verify_mark        | succeeded |         1 |         0.00 |                 0

v_job_queue_backlog: 0 queued / leased / retry_waiting / failed / dead_letter. No stuck jobs.

4. Why attempts=0 on cut.cut after the section_type incident

The first fn_iu_op_cut call raised an error mid-execution (see 00-summary.md §3). Because this raise occurs inside an implicit autocommit statement, PostgreSQL rolled back that SELECT only; the row remained leased with the same picked_at, lease_owner, and lease_until. The attempts counter is incremented by fn_job_fail_or_retry, which we did not call — we patched the payload and re-invoked the alias from the same lease. On success we called fn_job_ack, which transitioned leased → succeeded without touching attempts.

This is a clean recovery: no retry waiting, no DLQ traffic, lease held continuously by the original owner from 15:13:49 to 15:17:39 (lease window 300 s; recovery completed at 00:03:50 — within the lease).

5. Heartbeat ticks

executor_name executor_kind last_tick_status ticks_total metadata.phase metadata.run_id
dieu45_phase3_pilot external_worker ok 2 enqueueddone bf3e6f4d…
iu_outbound_default PG_worker warn 0 (legacy passive marker; §15.5 silent-gap surface)

The legacy iu_outbound_default row was created in Phase 2 (legacy_silent_passive marker) and is unchanged by this pilot. Its last_tick_at remains 2026-05-22 11:31:41+00 (age_seconds=359,352) and the v_queue_health view still classifies it as executors_stale=1. Closing this gap durably is reserved for the next phase.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-dieu45-phase-3-mark-cut-queue-pilot-dieu37-write-channel/03-queue-job-sequence.md