KB-30FE
S142 Bugfix Report — TD-312 + TD-311
3 min read Revision 1
reports142bugfixtd-312td-311
S142: Fix Pre-existing Bugs + Missing Status Fields
Date: 2026-03-19 Status: COMPLETE
Assembly Gate
| # | Question | Answer |
|---|---|---|
| Q0 | PostgreSQL ready? | Yes — checked PG triggers, verify_counts, fn_lifecycle_summary |
| Q1 | Directus ready? | Yes — checked permissions, field configs, flows |
| Q2-Q5 | N/A | Bug fix + field addition, no UI/custom code |
Part A: TD-312 — POST /items/agents returns 500
Root Cause
- [AUTO-ID] Agents flow (e7483fee) had a hardcoded expired JWT token (900s lifetime, created 2026-03-06). The flow type was
filter(blocking), so expired token → 403 → 500. codefield hadrequired: true+NOT NULLwithout default, blocking Directus before PG trigger could generate code.
Fix
- Disabled
[AUTO-ID] Agentsflow — redundant with PG triggertrg_auto_code_agents→gen_code_agents()using sequence. - Set
agents.coderequired=false in Directus meta + SET DEFAULT '' in PG.
Note
12 other AUTO-ID flows have same expired token issue. All redundant with PG triggers. Recommend disabling all in future mission.
Part B: TD-311 — Add status field to 3 collections
| Collection | Records | Status Added | All Active |
|---|---|---|---|
| workflow_steps | 70 | ✅ | ✅ 70/70 |
| trigger_registry | 107 | ✅ | ✅ 107/107 |
| task_comments | 75 | ✅ | ✅ 75/75 |
Field config: string, default 'active', NOT NULL, dropdown (draft/active/deprecated/retired), labels display with colors.
Verification
| # | Condition | Result |
|---|---|---|
| 1 | Root cause identified | ✅ Expired JWT + required code field |
| 2 | POST /items/agents succeeds | ✅ HTTP 200, AGT-010 |
| 3 | workflow_steps has status | ✅ |
| 4 | trigger_registry has status | ✅ |
| 5 | task_comments has status | ✅ |
| 6 | Existing records active | ✅ 252/252 |
| 7 | fn_lifecycle_summary | ✅ 3 new collections |
| 8 | verify_counts 0 MISMATCH | ✅ 19/19 OK |
| 9 | Coverage Inspector | 3 pre-existing blind spots (not S142) |
| 10 | Smoke test | ✅ PASS |