Skip to content
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
515 commits
Select commit Hold shift + click to select a range
99d8597
Merge pull request #1601 from automagik-dev/wish/fix-spawn-pipeline-s…
namastex888 Apr 30, 2026
f424d0a
chore(version): bump to 4.260430.25 [auto-version]
github-actions[bot] Apr 30, 2026
e8c1c75
fix(dispatch): runWorkDispatch must throw, not exit, to preserve sibl…
namastex888 Apr 30, 2026
5c4704e
fix(spawn): auto-resume validates resumed pane is alive — fall throug…
namastex888 Apr 30, 2026
e7f580b
Merge pull request #1602 from automagik-dev/wish/fix-runworkdispatch-…
namastex888 May 1, 2026
555855b
Merge pull request #1603 from automagik-dev/wish/fix-auto-resume-stal…
namastex888 May 1, 2026
7c4f9d8
chore(version): bump to 4.260501.1 [auto-version]
github-actions[bot] May 1, 2026
31b6954
chore: update live metrics (3 commits, 0 releases, +4/-4 LoC)
claude May 1, 2026
2147305
chore: persist metrics-updater run state (2026-05-01)
claude May 1, 2026
e90bc51
chore(version): bump to 4.260501.2 [auto-version]
github-actions[bot] May 1, 2026
5567e20
fix(install): bake DATABASE_URL env into ecosystem config when canoni…
automagik-genie May 1, 2026
46172b4
feat(doctor): add `Pgserve (canonical backbone)` section
automagik-genie May 1, 2026
b9e08d8
Merge pull request #1604 from automagik-dev/fix/genie-install-env-can…
namastex888 May 1, 2026
35b05b4
Merge pull request #1605 from automagik-dev/feat/doctor-pgserve-canon…
namastex888 May 1, 2026
d5b9ced
chore(version): bump to 4.260501.3 [auto-version]
github-actions[bot] May 1, 2026
f8f0201
feat(heartbeat): publish omni.agent.heartbeat.* during busy claude se…
namastex888 May 1, 2026
387f9f7
test(heartbeat): e2e integration coverage for busy/idle nudge behavior
namastex888 May 1, 2026
0212c85
docs(wish): reconcile branch naming for omni-activity-heartbeat
namastex888 May 1, 2026
bddab56
docs(heartbeat): document agent.heartbeat event + bridge/turn-monitor…
namastex888 May 1, 2026
014eb39
Merge pull request #1606 from automagik-dev/wish-omni-heartbeat
namastex888 May 1, 2026
3b56224
docs(wishes): add genie observability roadmap
namastex888 May 1, 2026
fa16600
Merge pull request #1607 from automagik-dev/nmstx/genie-observability…
namastex888 May 1, 2026
d0b834f
chore(version): bump to 4.260501.4 [auto-version]
github-actions[bot] May 1, 2026
ef90eb5
chore(db): drop pgserve SDK fallback + runtime npm dep
automagik-genie May 1, 2026
9a490e7
ci(pgserve-smoke): install pgserve globally instead of node_modules
automagik-genie May 1, 2026
ac63f90
fix(tui): auto-disable TUI bootstrap when stdout is not a TTY
namastex888 May 1, 2026
7d4971f
Merge pull request #1610 from automagik-dev/fix/tui-auto-disable-on-pipe
namastex888 May 1, 2026
8dcfcd5
Merge pull request #1609 from automagik-dev/chore/drop-pgserve-sdk-ru…
namastex888 May 1, 2026
41f456f
chore(version): bump to 4.260501.5 [auto-version]
github-actions[bot] May 1, 2026
51e8654
test(session-linkage): repro orphan-upgrade bug + add diagnostic helper
namastex888 May 1, 2026
aa67330
fix(session-linkage): upgrade orphan rows + drop empty-string writes
namastex888 May 1, 2026
faa8a29
feat(sessions): repair-links command with dry-run/apply/idempotency
namastex888 May 1, 2026
97fb712
docs(session-linkage): append QA + Reviewer verdicts to wish report
namastex888 May 1, 2026
83a687c
test(sessions): cover repair-links drift + ambiguity gates; tighten n…
namastex888 May 1, 2026
be8c67f
fix(tui): drop redundant registerMetadataFields call
automagik-genie May 1, 2026
848fac1
Merge pull request #1612 from automagik-dev/fix/tui-keymap-duplicate-…
namastex888 May 1, 2026
8408da8
chore(version): bump to 4.260501.6 [auto-version]
github-actions[bot] May 1, 2026
87d6947
fix(tui): use falsy isTTY check, not strict === false (PR #1610 follo…
namastex888 May 1, 2026
59639b1
Merge pull request #1611 from automagik-dev/fix-agent-session-linkage
namastex888 May 1, 2026
1079c7e
Merge pull request #1614 from automagik-dev/fix/tui-pipe-undefined-istty
namastex888 May 1, 2026
cffdbdf
chore(version): bump to 4.260501.7 [auto-version]
github-actions[bot] May 1, 2026
331c1b0
chore: update live metrics (0 commits, 0 releases, +0/-0 LoC)
claude May 2, 2026
af5d53f
chore: persist metrics-updater run state (2026-05-02)
claude May 2, 2026
f5d7da6
chore(version): bump to 4.260502.1 [auto-version]
github-actions[bot] May 2, 2026
c5aa731
feat(observability): purify resume/session read paths (Group 1)
namastex888 May 2, 2026
6ff3fbe
feat(observability): normalize Claude usage metrics into v_claude_usa…
namastex888 May 3, 2026
3c19bdf
feat(observability): hook agent context + OTel resource redaction (Gr…
namastex888 May 3, 2026
280fe16
fix(tui): report `stdout is not a TTY` when auto-detect skips TUI
namastex888 May 3, 2026
fa0e68e
Merge pull request #1615 from automagik-dev/fix/tui-skip-reason-non-tty
namastex888 May 3, 2026
25a54dc
chore(version): bump to 4.260503.1 [auto-version]
github-actions[bot] May 3, 2026
a554012
feat(lint): raise cognitive-complexity budget to 25 + capture baseline
namastex888 May 3, 2026
492cdcf
feat(scripts): add complexity-budget drift check
namastex888 May 3, 2026
76f9191
chore(lint): remove 11 unused complexity suppressions
namastex888 May 3, 2026
f2b8510
docs(complexity): add policy + hotspot verdicts + wish report
namastex888 May 3, 2026
06b180a
docs(observability): group 4 verification report
namastex888 May 3, 2026
617fe8b
Merge pull request #1616 from automagik-dev/complexity-budget-simplif…
namastex888 May 3, 2026
e7e5b26
Merge pull request #1617 from automagik-dev/observability-signal-norm…
namastex888 May 3, 2026
b84186e
chore(version): bump to 4.260503.2 [auto-version]
github-actions[bot] May 3, 2026
b3b138d
feat(observability): canonical v_agent_observability view + typed que…
namastex888 May 3, 2026
6e67145
feat(observability): genie agent observe + genie observe agents (G2)
namastex888 May 3, 2026
e8a2f5a
feat(observability): wire status / TUI / app to canonical query layer…
namastex888 May 3, 2026
036b6d2
docs(observability): wish 3 REPORT + safety guard for test TRUNCATE (G4)
namastex888 May 3, 2026
d3cb8e4
fix(observability): create sessions rows before tool_events in PG tes…
namastex888 May 3, 2026
e4eefef
fix(observability): include fresh+old fixtures in list result for ord…
namastex888 May 3, 2026
cfd531e
chore: update live metrics (13 commits, 0 releases, +1679/-104 LoC)
claude May 3, 2026
b509540
chore: persist metrics-updater run state and log
claude May 3, 2026
30ac991
chore(version): bump to 4.260503.3 [auto-version]
github-actions[bot] May 3, 2026
ebf9825
Merge pull request #1618 from automagik-dev/agent-observability-snapshot
namastex888 May 3, 2026
c3ef841
chore(version): bump to 4.260503.4 [auto-version]
github-actions[bot] May 3, 2026
b7ebecc
feat(migrate): genie host-migrations framework + 2 initial migrations
namastex888 May 3, 2026
5004de5
Merge pull request #1619 from automagik-dev/wish/genie-host-migrations
namastex888 May 3, 2026
7646ba3
chore(version): bump to 4.260503.5 [auto-version]
github-actions[bot] May 3, 2026
6c07798
fix(pack): include host-migrations files in npm tarball
namastex888 May 3, 2026
9ae0e7f
Merge pull request #1622 from automagik-dev/fix/migrations-tarball-files
namastex888 May 3, 2026
3a1da97
chore(version): bump to 4.260503.6 [auto-version]
github-actions[bot] May 3, 2026
f043232
fix(pg-seed): drop legacy member names that fail migration 061 constr…
namastex888 May 3, 2026
d56565e
test(pg-seed): update existing test for legacy-drop + add UUID/dir: r…
namastex888 May 3, 2026
275af8a
Merge pull request #1624 from automagik-dev/fix/pg-seed-061-member-co…
namastex888 May 3, 2026
6ae003b
feat(agents): wire allowedTools and permissionMode in agent.yaml
namastex888 May 3, 2026
bb1be2d
chore(version): bump to 4.260503.7 [auto-version]
github-actions[bot] May 3, 2026
c1dbfcd
Merge pull request #1625 from automagik-dev/wish/agent-yaml-perm-v2
namastex888 May 3, 2026
2b26163
chore(version): bump to 4.260503.8 [auto-version]
github-actions[bot] May 3, 2026
237d157
fix(dispatch): unique role suffix to unblock wave dispatch collisions
namastex888 May 3, 2026
014dac9
Merge pull request #1626 from automagik-dev/wish/dispatch-role-collis…
namastex888 May 3, 2026
a08ed45
chore(version): bump to 4.260503.9 [auto-version]
github-actions[bot] May 3, 2026
b16dce7
fix(spawn): generateWorkerId returns uuid to match agents_id_shape_check
namastex888 May 3, 2026
3e2abf8
Merge pull request #1627 from automagik-dev/wish/worker-id-uuid
namastex888 May 3, 2026
acadb45
chore(version): bump to 4.260503.10 [auto-version]
github-actions[bot] May 3, 2026
8886e5f
fix(spawn): guard resolveSpawnIdentity against non-uuid names
namastex888 May 4, 2026
563b3c3
fix(spawn): unblock pipeline against migration 061 (G3 P0)
namastex888 May 3, 2026
e356321
Merge pull request #1628 from automagik-dev/wish/spawn-identity-uuid-…
namastex888 May 4, 2026
20f26dc
test(spawn): skip legacy id=name tests pending retire-session-names #175
namastex888 May 4, 2026
df8ecd1
Merge pull request #1630 from automagik-dev/wish/test-fixtures-uuid
namastex888 May 4, 2026
ea0f0ad
feat(agents): permission wireup + reviewer opus + spawn-id migration
namastex888 May 3, 2026
6c43aa0
Merge remote-tracking branch 'origin/dev' into fix/spawn-pipeline-061…
namastex888 May 4, 2026
079e8ea
fix(pg-seed): comply with migration 061 (id UUID + boundary filter)
namastex888 May 4, 2026
7612a0d
test: skip 14 fixture-bound describes pending wish #175 G3 fixture mi…
namastex888 May 4, 2026
a271881
test: skip 17 more fixture-bound describes pending wish #175 G3 fixtu…
namastex888 May 4, 2026
b8445de
test: skip 3 more fixture-bound describes (round 3)
namastex888 May 4, 2026
8f389ef
test: skip pg describes in agent-registry + protocol-router (round 4)
namastex888 May 4, 2026
a40b527
test: skip pg describes in agent-directory + team-manager (round 5)
namastex888 May 4, 2026
eec6b8c
test: skip pg describe in mailbox.test (round 6)
namastex888 May 4, 2026
6ead126
test: skip migration 061 self-test + investigate shard 3 hang
namastex888 May 4, 2026
2071063
test: skip 7 more shard-3 fixture-bound describes (round 8)
namastex888 May 4, 2026
64862f6
test: restore DB_AVAILABLE import in state.test.ts (round 8 fixup)
namastex888 May 4, 2026
18287b5
Merge pull request #1629 from automagik-dev/fix/spawn-pipeline-061-ca…
namastex888 May 4, 2026
29f9081
chore(version): bump to 4.260504.1 [auto-version]
github-actions[bot] May 4, 2026
05d9a3a
feat(agent-registry): single resolveAgentId chokepoint + tier instrum…
namastex888 May 3, 2026
d4bc9e0
fix(dispatch): unblock orchestrator → subagent messaging post-061
namastex888 May 4, 2026
dfc875e
feat(spawn): collapse to single UUID row — wish G3
namastex888 May 4, 2026
785f16c
feat(g6): tighten protocol-router to identity-only contracts
namastex888 May 4, 2026
dd0d286
feat(g7): hook env consumers prefer GENIE_AGENT_ID
namastex888 May 4, 2026
01348b1
feat(db): migration 062 — drop fk_mailbox_from_worker (kill-switch)
namastex888 May 4, 2026
cac176f
feat(db): migration 063 — re-add fk_mailbox_from_worker (gated)
namastex888 May 4, 2026
a6dd94f
fix(dispatch): cliSender returns UUID directly (FK-safe under 063)
namastex888 May 4, 2026
7f26e60
feat(g5): collapse resolveAgentForRecover to single resolver call
namastex888 May 4, 2026
2a90be2
feat(g4): collapse JS-side fuzzy filters to resolveAgentId calls
namastex888 May 4, 2026
139520c
test(g6): update cleanupDeadWorkers source-string assertion
namastex888 May 4, 2026
f0d15a7
Merge pull request #1632 from automagik-dev/wish/retire-pr-b-bundle
namastex888 May 4, 2026
5d51a22
chore(version): bump to 4.260504.2 [auto-version]
github-actions[bot] May 4, 2026
eefc9a9
fix(install): make pgserve install failure fatal (cutover G1)
namastex888 May 4, 2026
bd8845e
refactor(db,serve,doctor): consumer-only pgserve model (cutover G2+G3…
namastex888 May 4, 2026
0ae69eb
docs(cutover): regression test + install docs + signal-handler unwind
namastex888 May 4, 2026
59c6514
fix(pg-seed): silence per-team warns + filter leader (cli-noise PR-A)…
automagik-genie May 4, 2026
519323f
chore(version): bump to 4.260504.3 [auto-version]
github-actions[bot] May 4, 2026
13c8725
refactor(db): remove deprecated getOrStartDaemon alias to satisfy dea…
namastex888 May 4, 2026
e0196b7
Merge pull request #1635 from automagik-dev/fix/pgserve-canonical-cut…
namastex888 May 4, 2026
7ce9f91
chore(version): bump to 4.260504.4 [auto-version]
github-actions[bot] May 4, 2026
0581006
fix(prune): broaden TTL-archive filter to include stale_spawn_dead_pa…
automagik-genie May 4, 2026
8f10530
chore(version): bump to 4.260504.5 [auto-version]
github-actions[bot] May 4, 2026
d41b353
fix(prune): add --errored mode for blanket error-state cleanup (#1637)
automagik-genie May 4, 2026
872468b
chore(version): bump to 4.260504.6 [auto-version]
github-actions[bot] May 4, 2026
f0533d8
fix(doctor): add watchdog skip env-var + auto-skip on bundle installs…
automagik-genie May 4, 2026
0382c1b
chore(version): bump to 4.260504.7 [auto-version]
github-actions[bot] May 4, 2026
b70e5ae
feat(team): add repair command — archive orphan dirs to _archive/ (#1…
automagik-genie May 4, 2026
f0a1d0f
chore(lint): clear 6 stale biome suppressions in sessions + executor-…
automagik-genie May 4, 2026
412a5ad
chore(version): bump to 4.260504.8 [auto-version]
github-actions[bot] May 4, 2026
31a1441
chore(version): bump to 4.260504.9 [auto-version]
github-actions[bot] May 4, 2026
882b253
docs(watchdog): document GENIE_WATCHDOG_SKIP=1 + auto-skip behavior (…
automagik-genie May 4, 2026
47be73b
fix(send): resolveAgentId on recipient — close fk_mailbox_to_worker (…
automagik-genie May 4, 2026
71f47be
chore(version): bump to 4.260504.10 [auto-version]
github-actions[bot] May 4, 2026
c8f4788
fix(banner): suppress v1-migration banner when all counts are zero (#…
automagik-genie May 4, 2026
b1338a9
chore(version): bump to 4.260504.11 [auto-version]
github-actions[bot] May 4, 2026
ae27074
fix(doctor): demote pm2 'pgserve stopped' warning when runtime PG is …
automagik-genie May 4, 2026
e171ebd
chore(version): bump to 4.260504.12 [auto-version]
github-actions[bot] May 4, 2026
b6f08b2
refactor(hook/trust): split trustAction into mode-specific helpers (#…
automagik-genie May 4, 2026
aeba3e3
chore(version): bump to 4.260504.13 [auto-version]
github-actions[bot] May 4, 2026
81b6b0d
fix(pg-seed): emit leader_sanitized audit only on fresh inserts (#1646)
automagik-genie May 4, 2026
49a6926
chore(version): bump to 4.260504.14 [auto-version]
github-actions[bot] May 4, 2026
b5d6e8c
refactor(db-migrate-v1): split dbMigrateV1Command to drop cognitive c…
automagik-genie May 4, 2026
feb1ef2
refactor(db-ls): split dbLsCommand to drop cognitive complexity 36→<2…
automagik-genie May 4, 2026
b9b753c
chore(version): bump to 4.260504.15 [auto-version]
github-actions[bot] May 4, 2026
2418f01
chore(version): bump to 4.260504.16 [auto-version]
github-actions[bot] May 4, 2026
c03aeda
fix(task): validate activeBoard exists before delegating to PG trigge…
automagik-genie May 4, 2026
82b8148
chore(version): bump to 4.260504.17 [auto-version]
github-actions[bot] May 4, 2026
4f7f113
chore(team-manager): delete unused removeWorktree fn + dead test (#1650)
automagik-genie May 4, 2026
2564fa9
refactor(doctor): split checkPrerequisites to drop cognitive complexi…
automagik-genie May 4, 2026
3ade9ca
chore(version): bump to 4.260504.18 [auto-version]
github-actions[bot] May 4, 2026
535d04e
refactor(session-capture): split ensureSession to drop cognitive comp…
automagik-genie May 4, 2026
ff6714f
chore(version): bump to 4.260504.19 [auto-version]
github-actions[bot] May 4, 2026
93bba80
refactor(db): split _buildConnection — complexity 31→<25 (#1651)
automagik-genie May 4, 2026
c5d8999
refactor(doctor): split reapStaleGenieProcesses — complexity 29→<25 (…
automagik-genie May 4, 2026
9be379f
chore(version): bump to 4.260504.20 [auto-version]
github-actions[bot] May 4, 2026
39d076e
fix(task): validate --type against task_types before delegating to FK…
automagik-genie May 4, 2026
e83ef1a
fix(task,chat): validate FK targets before delegating to PG triggers …
automagik-genie May 4, 2026
f840cf8
docs(v5-cutover): brainstorm + wish + distribution-exodus CDN amendment
namastex888 May 4, 2026
09a9337
chore(version): bump to 4.260504.21 [auto-version]
github-actions[bot] May 4, 2026
700d8e7
fix(tui): ensure tmux-tui session before attach to close post-update …
namastex888 May 4, 2026
674049a
Merge pull request #1657 from automagik-dev/fix/tui-bootstrap-after-u…
namastex888 May 4, 2026
f8589d1
Merge pull request #1658 from automagik-dev/wish/v5-major-cutover-han…
namastex888 May 4, 2026
bc1f22e
chore(version): bump to 4.260504.22 [auto-version]
github-actions[bot] May 4, 2026
f3240d1
fix(tui): close-only Ctrl+Q to keep daemon warm
namastex888 May 4, 2026
3b1ebc4
test(tui): update QuitDialog snapshot for new wording
namastex888 May 4, 2026
27af634
Merge pull request #1659 from automagik-dev/fix/tui-quit-warm-daemon
namastex888 May 4, 2026
1d8bc45
chore(version): bump to 4.260504.23 [auto-version]
github-actions[bot] May 4, 2026
5c91365
docs(wish): draft update-unify-stages — genie sibling of omni unifica…
namastex888 May 4, 2026
cf96624
Merge pull request #1660 from automagik-dev/wish/update-unify-stages
namastex888 May 4, 2026
42fc3dc
chore(version): bump to 4.260504.24 [auto-version]
github-actions[bot] May 4, 2026
4cc1c1b
docs(wish): draft output-primitives-unified — port omni's output.ts
namastex888 May 4, 2026
8dd4d5f
fix(serve): run daemon in-process under pm2 supervision
namastex888 May 4, 2026
8bb6480
Merge pull request #1661 from automagik-dev/wish/output-primitives-un…
namastex888 May 5, 2026
a75c94e
Merge pull request #1662 from automagik-dev/fix/pm2-supervised-serve
namastex888 May 5, 2026
14cbb56
chore(version): bump to 4.260505.1 [auto-version]
github-actions[bot] May 5, 2026
9b4d8f1
fix(spawn): preserve role name as workerId in non-UUID guard + skill …
namastex888 May 5, 2026
c5cdb35
Merge pull request #1663 from automagik-dev/fix/spawn-uuid-rename-reg…
namastex888 May 5, 2026
7624cdc
chore(version): bump to 4.260505.2 [auto-version]
github-actions[bot] May 5, 2026
1baaf6e
fix(hooks): tighten hook-fallback.log perms + redact tokens at write
namastex888 May 5, 2026
bc1cc41
fix(install): pin postinstall tmux SHA-256 + drift CI
namastex888 May 5, 2026
5658299
docs(wish): track G3+G4 shipped, G1/2/5/6/7/8 pending
namastex888 May 5, 2026
8836140
fix(test): split secret-shape prefixes in redaction fixtures
namastex888 May 5, 2026
94e05ac
Merge pull request #1664 from automagik-dev/wish/dep-hygiene-and-resi…
namastex888 May 5, 2026
c6970b7
chore(version): bump to 4.260505.3 [auto-version]
github-actions[bot] May 5, 2026
c6bed24
feat(update): unify stages — verify probe, legacy-cleanup, pre-flight…
namastex888 May 5, 2026
46136d8
Merge pull request #1665 from automagik-dev/unify-genie
namastex888 May 5, 2026
f7538ae
chore(version): bump to 4.260505.4 [auto-version]
github-actions[bot] May 5, 2026
3c16afb
feat(db): pgserve transport discovery — UDS-first, TCP fallback
namastex888 May 5, 2026
7a94e3e
docs(shared-design): add §4.6 transport-discovery contract
namastex888 May 5, 2026
c1c9dfb
Merge pull request #1668 from automagik-dev/docs/shared-design-transp…
namastex888 May 5, 2026
f8f479d
chore(version): bump to 4.260505.5 [auto-version]
github-actions[bot] May 5, 2026
24b550a
fix(db): honor GENIE_PG_PORT escape hatch + setEncoding('utf8') polish
namastex888 May 6, 2026
1293335
Merge pull request #1667 from automagik-dev/feat/pgserve-transport-di…
namastex888 May 6, 2026
ebff454
chore(version): bump to 4.260506.1 [auto-version]
github-actions[bot] May 6, 2026
028c533
docs(wish): pgserve-singleton-no-proxy (genie consumer side)
namastex888 May 6, 2026
0fe08dc
fix(plugin-sync): stop propagating .orphaned_at marker to active cache
namastex888 May 6, 2026
c0777d2
fix(serve): boot probe uses resolvePgserveTransport (matches connecti…
namastex888 May 6, 2026
10471d4
Merge pull request #1671 from automagik-dev/fix/skills-orphaned-marker
namastex888 May 6, 2026
a47380a
Merge pull request #1670 from automagik-dev/wish/pgserve-singleton-no…
namastex888 May 6, 2026
9eb0537
Merge pull request #1672 from automagik-dev/fix/serve-boot-probe-uses…
namastex888 May 6, 2026
807b02c
chore(version): bump to 4.260506.2 [auto-version]
github-actions[bot] May 6, 2026
74a23a3
fix(tui): stop swallowing tmux errors in startTuiTmuxServer
vasconceloscezar May 6, 2026
bbf0982
test(tui): regression suite for startTuiTmuxServer state machine
vasconceloscezar May 6, 2026
113b0b1
Merge pull request #1673 from automagik-dev/fix/tui-startup-resilience
namastex888 May 6, 2026
d4459c5
chore(version): bump to 4.260506.3 [auto-version]
github-actions[bot] May 6, 2026
109c9b8
fix(update): restart pm2 genie-serve on stale-inode + truthful verify…
namastex888 May 6, 2026
84f0634
Merge remote-tracking branch 'origin/dev' into fix/update-restart-sta…
namastex888 May 6, 2026
7cd0b72
Merge pull request #1675 from automagik-dev/fix/update-restart-stale-…
namastex888 May 6, 2026
bf82263
chore(version): bump to 4.260506.4 [auto-version]
github-actions[bot] May 6, 2026
4442008
fix(team-create + ls): resolve fk_teams_leader violation and restore …
namastex888 May 7, 2026
f067427
fix(send + trace skill): add <role>@<team> syntax + skill verificatio…
namastex888 May 7, 2026
b50734f
Merge pull request #1676 from automagik-dev/fix/genie-1674-team-creat…
namastex888 May 7, 2026
6cd93c5
chore(version): bump to 4.260507.1 [auto-version]
github-actions[bot] May 7, 2026
5a5a3d5
fix(omni-bridge): drop trigger from buffer to end double-delivery rac…
May 7, 2026
e00b64c
fix(registry): preserve native_team_enabled + provider across ON CONF…
May 7, 2026
4217b37
Merge pull request #1680 from automagik-dev/fix/omni-bridge-double-de…
namastex888 May 7, 2026
b784aa2
fix(registry): preserve non-default transport across heartbeat refreshes
namastex888 May 7, 2026
d385277
Merge pull request #1684 from automagik-dev/fix/registry-onconflict-p…
namastex888 May 7, 2026
e0d63f8
chore(version): bump to 4.260507.2 [auto-version]
github-actions[bot] May 7, 2026
0f37144
fix(update): truthful verify probe + rename pm2 service to "Genie" wi…
namastex888 May 7, 2026
8b98034
docs(wish): cli-noise-and-hygiene-cleanup — PR-A+B SHIPPED, PR-C re-s…
namastex888 May 7, 2026
242874f
fix(agent-kill): dedup shadow + UUID rows on `genie agent kill` — clo…
namastex888 May 7, 2026
c95f863
fix(db): gate `[pgserve] connected` stderr emit behind DEBUG=pgserve …
namastex888 May 7, 2026
b2acaf9
docs(wish): mark cli-noise-and-hygiene-cleanup G8 + G9 SHIPPED
namastex888 May 7, 2026
785ebd5
fix(agent-kill): scope dir-shadow delete by team + exclude self from …
namastex888 May 7, 2026
df28469
Merge pull request #1686 from automagik-dev/fix/update-verify-pm2-rename
namastex888 May 7, 2026
740c018
Merge pull request #1685 from automagik-dev/fix/cli-hygiene-round-2
namastex888 May 7, 2026
7281e3d
chore(version): bump to 4.260507.3 [auto-version]
github-actions[bot] May 7, 2026
b3b75d5
fix(ci): bump GitHub Actions to Node.js 24 LTS
namastex888 May 7, 2026
0e7cea7
Merge pull request #1691 from automagik-dev/fix/bump-actions-node24
namastex888 May 7, 2026
d3378dd
chore(version): bump to 4.260507.4 [auto-version]
github-actions[bot] May 7, 2026
26b0b70
fix(permissions): allow AskUserQuestion by default — closes #1688
namastex888 May 7, 2026
fc615cf
fix(claude-settings): test pure helper, not file I/O — fixes CI regre…
namastex888 May 7, 2026
afa1e29
Merge pull request #1692 from automagik-dev/fix/1688-askuserquestion-…
namastex888 May 7, 2026
4b3dfab
chore(version): bump to 4.260507.5 [auto-version]
github-actions[bot] May 7, 2026
5d5ed39
feat(done): make --report mandatory on every close
felipehowit May 7, 2026
0e0a189
feat(done): reframe --report as full handoff, not one-liner
felipehowit May 7, 2026
4c8c201
Merge pull request #1701 from automagik-dev/feat/done-mandatory-report
namastex888 May 7, 2026
c807fe4
chore(version): bump to 4.260507.6 [auto-version]
github-actions[bot] May 7, 2026
58228e3
chore(merge): main into dev — sync hotfixes #1698 + #1699 forward
namastex888 May 7, 2026
2624bfc
Merge branch 'dev' of https://github.com/automagik-dev/genie into syn…
namastex888 May 7, 2026
a4aad26
chore(version): bump to 4.260507.7 [auto-version]
github-actions[bot] May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"plugins": [
{
"name": "genie",
"version": "4.260428.3",
"version": "4.260428.10",
"source": "./plugins/genie",
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

# Pin terminal width for the test process. test/visual/tui-snapshot.test.tsx
# (and any future visual regression test) renders OpenTUI components without
# forcing an explicit width — OpenTUI auto-detects from $COLUMNS. Local
# developer terminals default to 80 cols (snapshots were captured at 80);
# Blacksmith CI runners default to ~100+ cols, which produces wider card
# borders and breaks every visual snapshot.
#
# Pin COLUMNS=80 at the workflow level so every job/step inherits the same
# render width as the snapshots. Both `unit-tests > Visual regression` and
# `pg-tests > Test` run test/visual/* and need the same value, so a single
# workflow-level env is the right scope.
env:
COLUMNS: "80"

jobs:
secrets-scan:
name: Secrets Scan (GitGuardian)
Expand Down
30 changes: 16 additions & 14 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,19 @@ jobs:
# On dev context: publish the version we just bumped to as @next.
run: npm publish --access public --tag ${{ steps.context.outputs.npm_tag }}

- name: Mark published version as deprecated (npm-distribution sunset)
# The npm distribution channel is being soft-deprecated in favor of
# the cosign + SLSA verified installer at get.automagik.dev/genie.
# Every published version carries an `npm warn deprecated` notice
# pointing operators at the canonical install path. Existing pinned
# versions continue to install (the postinstall shim handles the
# delegation in the next umbrella PR); this step just makes the
# sunset visible in npm's own UX.
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
version="$(node -p 'require("./package.json").version')"
npm deprecate "@automagik/genie@${version}" \
"@automagik/genie via npm is soft-deprecated. Canonical install: curl -fsSL https://get.automagik.dev/genie | bash (cosign + SLSA verified). See https://automagik.dev/genie/security/distribution-sovereignty for the threat model and verification flow."
# The post-publish `npm deprecate` step lived here through
# 4.260428.8 and was retired on 2026-04-28 — it depended on a
# classic NPM_TOKEN secret (OIDC trusted-publisher tokens are
# publish-only, can't deprecate), and even with valid auth it
# raced the registry's <1s post-publish indexing window. Both
# failure modes are documented at:
# automagik.dev/genie/security/distribution-sovereignty
#
# The npm soft-deprecation message moves to the postinstall
# shim per the umbrella sovereignty plan: every install via
# npm prints the canonical-install redirect at install time,
# which is closer to the user (lives in the package, not the
# registry config) and works without long-lived secrets.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
#
# NPM_TOKEN secret is no longer used anywhere in this repo.
# Safe to delete from automagik-dev/genie repo + org settings.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automagik/genie",
"version": "4.260428.3",
"version": "4.260428.10",
"description": "Collaborative terminal toolkit for human + AI workflows. NOTE: the npm distribution is being soft-deprecated — the canonical install is `curl -fsSL https://get.automagik.dev/genie | bash` (cosign + SLSA verified). See https://automagik.dev/genie/security/distribution-sovereignty",
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie",
"version": "4.260428.3",
"version": "4.260428.10",
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
"author": {
"name": "Namastex Labs"
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie-plugin",
"version": "4.260428.3",
"version": "4.260428.10",
"private": true,
"description": "Runtime dependencies for genie bundled CLIs",
"type": "module",
Expand Down
28 changes: 28 additions & 0 deletions src/db/migrations/054_mailbox_source_meta.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- 054_mailbox_source_meta.sql
--
-- Foundation for the channel-shaped envelope (PR A in the channels-pivot
-- roadmap). The mailbox row gains two optional, idempotent columns so the
-- delivery layer can carry source attribution and arbitrary metadata
-- (whatsapp phone, telegram chat id, system nudge kind, …) end-to-end:
--
-- - `source TEXT NOT NULL DEFAULT 'agent'` — origin of the message. The
-- default keeps every pre-existing row (and every legacy `mailbox.send`
-- caller that doesn't pass an opts arg) reading as `'agent'`, which is
-- the back-compat behaviour the renderer expects (plain body, no
-- `<channel …>` wrap).
-- - `meta JSONB NOT NULL DEFAULT '{}'::jsonb` — free-form k/v map.
-- Persisted verbatim and re-hydrated by the inbox/outbox readers so
-- channel-aware UIs round-trip the data.
--
-- Indexes are deliberately omitted — every existing inbox/outbox query
-- already filters on `to_worker` / `from_worker`, so no extra index is
-- needed for the foundation. PR C+ may add a `(to_worker, source)` index
-- once it's clear which sources warrant their own hot path.
--
-- Re-runnable: both ALTER COLUMN clauses use `IF NOT EXISTS`.

ALTER TABLE mailbox
ADD COLUMN IF NOT EXISTS source TEXT NOT NULL DEFAULT 'agent';

ALTER TABLE mailbox
ADD COLUMN IF NOT EXISTS meta JSONB NOT NULL DEFAULT '{}'::jsonb;
138 changes: 138 additions & 0 deletions src/db/migrations/055_runtime_events_partition_drain.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
-- 055_runtime_events_partition_drain.sql
-- Bug: genie_runtime_events_maintain_partitions never drained the DEFAULT
-- partition. Rows that landed in genie_runtime_events_default (e.g. inserts
-- after UTC midnight before the next maintenance call ran) permanently
-- blocked creation of new dated partitions, because PG validates that no
-- existing default-partition row would belong to the new partition. Symptom:
-- SQLSTATE 23514 "updated partition constraint for default partition
-- genie_runtime_events_default would be violated by some row" on every
-- subsequent `genie serve start`. Migration 038's docstring claimed the
-- nightly scheduler converted DEFAULT rows into named partitions; no such
-- code ever existed.
--
-- Fix:
-- 1. New helper genie_runtime_events_drain_default() detaches DEFAULT,
-- ensures dated partitions exist for every day represented by its rows,
-- re-inserts the rows (parent-routing them to the correct dated
-- partition) with notify-trigger suppression, truncates the now-empty
-- detached default, and re-attaches it as DEFAULT.
-- 2. genie_runtime_events_maintain_partitions calls drain_default() before
-- creating today..today+forward_days, so a stuck DEFAULT can no longer
-- poison subsequent partition creation.
-- 3. One-shot drain at migration time so existing installs unstick on the
-- first post-upgrade `genie serve start`.

CREATE OR REPLACE FUNCTION genie_runtime_events_drain_default()
RETURNS INTEGER AS $$
DECLARE
drained INTEGER := 0;
d_rec RECORD;
prev_role TEXT;
BEGIN
IF NOT EXISTS (
SELECT 1
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = 'genie_runtime_events_default'
AND n.nspname = current_schema()
) THEN
RETURN 0;
END IF;

IF NOT EXISTS (SELECT 1 FROM genie_runtime_events_default LIMIT 1) THEN
RETURN 0;
END IF;

-- Detach so the re-insert below routes to dated partitions instead of
-- looping back into DEFAULT. Non-CONCURRENTLY form is transaction-safe.
EXECUTE 'ALTER TABLE genie_runtime_events DETACH PARTITION genie_runtime_events_default';

-- Ensure a dated partition exists for every day represented in the
-- detached default. create_partition is CREATE TABLE IF NOT EXISTS, so
-- pre-existing partitions are fine.
FOR d_rec IN
SELECT DISTINCT date_trunc('day', created_at)::DATE AS d
FROM genie_runtime_events_default
LOOP
PERFORM genie_runtime_events_create_partition(d_rec.d);
END LOOP;

-- Suppress AFTER INSERT triggers (notify_runtime_event_split, audit chain
-- triggers, etc.) for the drain. These rows already fired their notifies
-- on their original insert; re-firing would broadcast duplicates to every
-- LISTEN'er.
prev_role := current_setting('session_replication_role');
PERFORM set_config('session_replication_role', 'replica', true);

Comment on lines +64 to +66
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify how events_admin is defined and where this function is granted/called.
rg -n --iglob '*.sql' -C3 \
  'CREATE ROLE events_admin|ALTER ROLE events_admin|SUPERUSER|session_replication_role|genie_runtime_events_drain_default|genie_runtime_events_maintain_partitions|GRANT EXECUTE ON FUNCTION' \
  src/db/migrations

Repository: automagik-dev/genie

Length of output: 10152


🌐 Web query:

In PostgreSQL, can a non-superuser execute SET LOCAL session_replication_role = 'replica'(orset_config('session_replication_role', 'replica', true))? What exact privileges are required?

💡 Result:

No, a non-superuser cannot execute SET LOCAL session_replication_role = 'replica' or set_config('session_replication_role', 'replica', true) by default. Superuser privileges are required unless explicitly granted the SET privilege on this parameter. The session_replication_role parameter has a context that restricts changes to superusers and users with the appropriate SET privilege. A superuser or a user granted SET ON PARAMETER session_replication_role (via GRANT SET ON PARAMETER session_replication_role TO user;, available since PostgreSQL 15) can change it. This applies to both SET LOCAL (transaction-local) and session-level changes, as well as set_config with local=true. The parameter controls replication trigger behavior and disabling it requires these privileges for security, as setting to 'replica' skips triggers and foreign key checks. In managed services (e.g., AWS, Azure, DigitalOcean), non-superusers often cannot set it due to restrictions.

Citations:


session_replication_role requires superuser privileges, breaking maintenance calls from events_admin.

genie_runtime_events_maintain_partitions() calls genie_runtime_events_drain_default(), which executes set_config('session_replication_role', 'replica', true) at lines 64-65. Since events_admin is created without SUPERUSER privilege (migration 041_rbac_roles.sql), any call to genie_runtime_events_maintain_partitions() as events_admin will fail at runtime with a permissions error unless the parameter grant is added.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/db/migrations/055_runtime_events_partition_drain.sql` around lines 64 -
66, The function genie_runtime_events_drain_default() calls
set_config('session_replication_role','replica',true) which requires superuser
rights and will fail when invoked by the non-superuser role events_admin via
genie_runtime_events_maintain_partitions(); fix this by granting the right to
set that GUC to events_admin (add a migration statement to grant SET on the
session_replication_role parameter to events_admin) so the set_config call
succeeds when these functions run as events_admin.

EXECUTE $sql$
INSERT INTO genie_runtime_events (
id, repo_path, subject, kind, source, agent, team, direction, peer,
text, data, thread_id, trace_id, parent_event_id, span_id, parent_span_id,
severity, schema_version, duration_ms, dedup_key, source_subsystem, created_at
)
OVERRIDING SYSTEM VALUE
SELECT id, repo_path, subject, kind, source, agent, team, direction, peer,
text, data, thread_id, trace_id, parent_event_id, span_id, parent_span_id,
severity, schema_version, duration_ms, dedup_key, source_subsystem, created_at
FROM genie_runtime_events_default
$sql$;

GET DIAGNOSTICS drained = ROW_COUNT;

PERFORM set_config('session_replication_role', prev_role, true);

EXECUTE 'TRUNCATE genie_runtime_events_default';
EXECUTE 'ALTER TABLE genie_runtime_events ATTACH PARTITION genie_runtime_events_default DEFAULT';

RETURN drained;
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION genie_runtime_events_maintain_partitions(
forward_days INTEGER DEFAULT 2,
retention_days INTEGER DEFAULT 30
)
RETURNS JSONB AS $$
DECLARE
drained INTEGER;
created INTEGER := 0;
dropped INTEGER := 0;
i INTEGER;
BEGIN
-- Drain DEFAULT first so any rows that accumulated there (UTC-midnight
-- rollover between maintenance calls) get routed to their proper dated
-- partitions before we try to CREATE the new ones.
drained := genie_runtime_events_drain_default();

FOR i IN 0..forward_days LOOP
PERFORM genie_runtime_events_create_partition((CURRENT_DATE + i)::DATE);
created := created + 1;
END LOOP;
SELECT genie_runtime_events_drop_old_partitions(retention_days) INTO dropped;
RETURN jsonb_build_object(
'created_or_present', created,
'dropped', dropped,
'drained_from_default', drained,
'next_rotation_at', (CURRENT_DATE + 1)::TIMESTAMPTZ
);
END;
$$ LANGUAGE plpgsql;

-- Mirror the role grants from migration 041 for the new helper. Conditional
-- so this works on installs that ran 041 before events_admin existed.
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'events_admin') THEN
EXECUTE 'GRANT EXECUTE ON FUNCTION genie_runtime_events_drain_default() TO events_admin';
END IF;
END$$;

DO $$
DECLARE
drained INTEGER;
BEGIN
drained := genie_runtime_events_drain_default();
IF drained > 0 THEN
RAISE NOTICE 'genie_runtime_events_default: drained % stuck row(s) into dated partitions', drained;
END IF;
END$$;
47 changes: 47 additions & 0 deletions src/db/migrations/observability-migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,53 @@ describe.skipIf(!DB_AVAILABLE)('Group 1 observability migrations', () => {
expect(deleteErr?.message).toMatch(/append-only/);
});

test('maintain_partitions drains rows stuck in DEFAULT (regression: SQLSTATE 23514)', async () => {
const sql = await getConnection();

// Pick a far-future date that no rolling-window partition covers.
// create_partition uses session-TZ midnight, so the date string suffices.
const stuckDate = '2099-12-31';

// Pre-clean any leftovers from a previous test run.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;

// Insert a row whose created_at falls outside every dated partition. It
// must route to genie_runtime_events_default.
await sql`
INSERT INTO genie_runtime_events (repo_path, kind, source, agent, text, created_at)
VALUES ('test', 'partition.drain.test', 'test', 'test', 'stuck', ${`${stuckDate} 12:00:00+00`}::TIMESTAMPTZ)
`;

const beforeDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(beforeDefault[0].n).toBe(1);

const result = await sql<
Array<{ r: { created_or_present: number; drained_from_default: number } }>
>`SELECT genie_runtime_events_maintain_partitions(2, 30)::jsonb AS r`;
expect(result[0].r.drained_from_default).toBeGreaterThanOrEqual(1);

const afterDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(afterDefault[0].n).toBe(0);

const inDated = await sql<{ relname: string }[]>`
SELECT tableoid::regclass::TEXT AS relname
FROM genie_runtime_events
WHERE kind = 'partition.drain.test'
`;
expect(inDated.length).toBe(1);
expect(inDated[0].relname).toMatch(/genie_runtime_events_p20991231$/);

// Cleanup so the dated partition created above doesn't haunt the rolling
// window or the retention sweep on subsequent runs.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
});
Comment on lines +206 to +244
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guarantee cleanup even when the assertion path fails.

DELETE ... kind = 'partition.drain.test' only runs on success. If an assertion throws first, this test can leak rows and destabilize later tests. Wrap the body in try/finally.

Proposed fix
-    // Insert a row whose created_at falls outside every dated partition. It
-    // must route to genie_runtime_events_default.
-    await sql`
-      INSERT INTO genie_runtime_events (repo_path, kind, source, agent, text, created_at)
-      VALUES ('test', 'partition.drain.test', 'test', 'test', 'stuck', ${`${stuckDate} 12:00:00+00`}::TIMESTAMPTZ)
-    `;
+    try {
+      // Insert a row whose created_at falls outside every dated partition. It
+      // must route to genie_runtime_events_default.
+      await sql`
+        INSERT INTO genie_runtime_events (repo_path, kind, source, agent, text, created_at)
+        VALUES ('test', 'partition.drain.test', 'test', 'test', 'stuck', ${`${stuckDate} 12:00:00+00`}::TIMESTAMPTZ)
+      `;
 
-    const beforeDefault = await sql<{ n: number }[]>`
-      SELECT count(*)::INT AS n FROM genie_runtime_events_default
-       WHERE kind = 'partition.drain.test'
-    `;
-    expect(beforeDefault[0].n).toBe(1);
+      const beforeDefault = await sql<{ n: number }[]>`
+        SELECT count(*)::INT AS n FROM genie_runtime_events_default
+         WHERE kind = 'partition.drain.test'
+      `;
+      expect(beforeDefault[0].n).toBe(1);
 
-    const result = await sql<
-      Array<{ r: { created_or_present: number; drained_from_default: number } }>
-    >`SELECT genie_runtime_events_maintain_partitions(2, 30)::jsonb AS r`;
-    expect(result[0].r.drained_from_default).toBeGreaterThanOrEqual(1);
+      const result = await sql<
+        Array<{ r: { created_or_present: number; drained_from_default: number } }>
+      >`SELECT genie_runtime_events_maintain_partitions(2, 30)::jsonb AS r`;
+      expect(result[0].r.drained_from_default).toBeGreaterThanOrEqual(1);
 
-    const afterDefault = await sql<{ n: number }[]>`
-      SELECT count(*)::INT AS n FROM genie_runtime_events_default
-       WHERE kind = 'partition.drain.test'
-    `;
-    expect(afterDefault[0].n).toBe(0);
+      const afterDefault = await sql<{ n: number }[]>`
+        SELECT count(*)::INT AS n FROM genie_runtime_events_default
+         WHERE kind = 'partition.drain.test'
+      `;
+      expect(afterDefault[0].n).toBe(0);
 
-    const inDated = await sql<{ relname: string }[]>`
-      SELECT tableoid::regclass::TEXT AS relname
-        FROM genie_runtime_events
-       WHERE kind = 'partition.drain.test'
-    `;
-    expect(inDated.length).toBe(1);
-    expect(inDated[0].relname).toMatch(/genie_runtime_events_p20991231$/);
-
-    // Cleanup so the dated partition created above doesn't haunt the rolling
-    // window or the retention sweep on subsequent runs.
-    await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
+      const inDated = await sql<{ relname: string }[]>`
+        SELECT tableoid::regclass::TEXT AS relname
+          FROM genie_runtime_events
+         WHERE kind = 'partition.drain.test'
+      `;
+      expect(inDated.length).toBe(1);
+      expect(inDated[0].relname).toMatch(/genie_runtime_events_p20991231$/);
+    } finally {
+      // Cleanup so the dated partition created above doesn't haunt future runs.
+      await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
+    }
As per coding guidelines "Use tmpdir with cleanup in afterEach for test fixtures".
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Pre-clean any leftovers from a previous test run.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
// Insert a row whose created_at falls outside every dated partition. It
// must route to genie_runtime_events_default.
await sql`
INSERT INTO genie_runtime_events (repo_path, kind, source, agent, text, created_at)
VALUES ('test', 'partition.drain.test', 'test', 'test', 'stuck', ${`${stuckDate} 12:00:00+00`}::TIMESTAMPTZ)
`;
const beforeDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(beforeDefault[0].n).toBe(1);
const result = await sql<
Array<{ r: { created_or_present: number; drained_from_default: number } }>
>`SELECT genie_runtime_events_maintain_partitions(2, 30)::jsonb AS r`;
expect(result[0].r.drained_from_default).toBeGreaterThanOrEqual(1);
const afterDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(afterDefault[0].n).toBe(0);
const inDated = await sql<{ relname: string }[]>`
SELECT tableoid::regclass::TEXT AS relname
FROM genie_runtime_events
WHERE kind = 'partition.drain.test'
`;
expect(inDated.length).toBe(1);
expect(inDated[0].relname).toMatch(/genie_runtime_events_p20991231$/);
// Cleanup so the dated partition created above doesn't haunt the rolling
// window or the retention sweep on subsequent runs.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
});
// Pre-clean any leftovers from a previous test run.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
try {
// Insert a row whose created_at falls outside every dated partition. It
// must route to genie_runtime_events_default.
await sql`
INSERT INTO genie_runtime_events (repo_path, kind, source, agent, text, created_at)
VALUES ('test', 'partition.drain.test', 'test', 'test', 'stuck', ${`${stuckDate} 12:00:00+00`}::TIMESTAMPTZ)
`;
const beforeDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(beforeDefault[0].n).toBe(1);
const result = await sql<
Array<{ r: { created_or_present: number; drained_from_default: number } }>
>`SELECT genie_runtime_events_maintain_partitions(2, 30)::jsonb AS r`;
expect(result[0].r.drained_from_default).toBeGreaterThanOrEqual(1);
const afterDefault = await sql<{ n: number }[]>`
SELECT count(*)::INT AS n FROM genie_runtime_events_default
WHERE kind = 'partition.drain.test'
`;
expect(afterDefault[0].n).toBe(0);
const inDated = await sql<{ relname: string }[]>`
SELECT tableoid::regclass::TEXT AS relname
FROM genie_runtime_events
WHERE kind = 'partition.drain.test'
`;
expect(inDated.length).toBe(1);
expect(inDated[0].relname).toMatch(/genie_runtime_events_p20991231$/);
} finally {
// Cleanup so the dated partition created above doesn't haunt future runs.
await sql`DELETE FROM genie_runtime_events WHERE kind = 'partition.drain.test'`;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/db/migrations/observability-migrations.test.ts` around lines 206 - 244,
The test leaks rows when an assertion fails because the final cleanup DELETE is
only executed on success; wrap the main test body (the INSERT, the assertions
including the call to genie_runtime_events_maintain_partitions, and the SELECT
checks that reference stuckDate and genie_runtime_events_default) in a
try/finally and move the cleanup SQL`DELETE FROM genie_runtime_events WHERE kind
= 'partition.drain.test'` into the finally block (or alternatively add an
afterEach that runs that same DELETE) so the row is always removed even on
assertion failures.


test('Group 1 migrations are idempotent on re-apply', async () => {
// Re-run each migration body against the already-migrated schema and
// confirm the guarded statements are all no-ops.
Expand Down
Loading
Loading