Commit 6ba4aa1
committed
fix: close 9 findings from Oracle audit wave 3 (dreamer/storage/rpc/system-prompt)
Three parallel read-only Oracles (dreamer subsystem; storage/migrations/sqlite
backend; RPC/TUI/system-prompt/conflict/auto-update). Cores verified safe (lease
atomicity/reclaim/renewal, circuit breaker, epoch semantics; schema fence,
fresh-DB migration, bind-style guard, transaction shim; RPC bearer auth +
session-scoped notifications, conflict canonical-name matching, auto-update
backgrounding). 9 source-confirmed fixes; design items banked (D1 reinforced, D5–D9).
P0:
- system-prompt handler fail-open (system-prompt-hash.ts). estimateTokens /
updateSessionMeta could throw into the prompt path (the caller just awaits) —
a busy/failing DB or pathological tokenizer would FAIL the LLM call instead of
losing a telemetry write. Per the project's fail-open-in-per-turn-handlers rule,
wrapped both in try/catch; the already-mutated prompt is preserved. +regression
test (drops session_meta mid-flight, asserts handler resolves + prompt intact).
P1:
- Dreamer lease-busy dequeue (runner.ts). With a live lease held (this project or
a sibling on the shared queue), the tick still dequeued, failed lease
acquisition, incremented retry, and after MAX_LEASE_RETRIES DELETED the queue
row — silently dropping a project's pending dream. Now skip the tick while a
lease is active; the entry stays queued.
- RPC token-file perms (rpc-server.ts). mkdir/writeFile mode only applies on
CREATE, so a pre-existing loose-perm dir or stale .tmp could leave the bearer
token world-readable. chmod the dir 0o700, rm stale tmp, chmod the final file
0o600 defensively.
- node:sqlite migration-conflict breadth (migrations.ts). isSiblingMigrationConflict
hard-gated on bun:sqlite error CODES; node:sqlite (Pi/Desktop) can report a
different/absent code for the same schema_migrations PK conflict → fail-CLOSE on
a legit concurrent-startup race (schema-fence incident class). Switched to the
backend-identical error MESSAGE + authoritative row-existence check.
P2:
- v35 raw ALTER → ensureColumn (migrations.ts): re-check-on-failure tolerates a
concurrent sibling adding share_categories.
- PRAGMA ordering: busy_timeout before journal_mode=WAL on the dashboard
read-write connection (db.rs) and the OpenCode compaction-marker direct-open
(compaction-marker.ts) — avoids immediate SQLITE_BUSY on cold-open contention.
- Dreamer optional-phase child sessions (runner.ts smart-notes, review-user-
memories.ts, identify-key-files.ts) now retained on FAILURE (debugging), mirroring
the main-task rule, instead of unconditional delete.
- Dashboard enqueue_dream dedup (db.rs): mirror the plugin's "skip if already
queued" + normalize to identity, so repeated "dream now" clicks don't pile up
duplicate rows a host drains one at a time.
- Conflict-disabled config hook early-return (index.ts): when a conflicting plugin
disabled the runtime, stop registering /ctx-* commands + hidden agents (pure UX
confusion — the runtime won't service them).
Gate: plugin 2175/0 (+2), Pi 471/0, dashboard rust 93+21+10+20/0, tsc+biome clean.1 parent c94798c commit 6ba4aa1
10 files changed
Lines changed: 157 additions & 27 deletions
File tree
- packages
- dashboard/src-tauri/src
- plugin/src
- features/magic-context
- dreamer
- key-files
- user-memory
- hooks/magic-context
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
4378 | 4381 | | |
4379 | 4382 | | |
4380 | 4383 | | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
| 4395 | + | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
4381 | 4400 | | |
4382 | 4401 | | |
4383 | 4402 | | |
4384 | | - | |
| 4403 | + | |
4385 | 4404 | | |
4386 | 4405 | | |
4387 | 4406 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
163 | 164 | | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
786 | 791 | | |
787 | 792 | | |
788 | 793 | | |
| |||
927 | 932 | | |
928 | 933 | | |
929 | 934 | | |
| 935 | + | |
930 | 936 | | |
931 | 937 | | |
932 | 938 | | |
| |||
943 | 949 | | |
944 | 950 | | |
945 | 951 | | |
946 | | - | |
| 952 | + | |
| 953 | + | |
947 | 954 | | |
948 | 955 | | |
949 | 956 | | |
| |||
999 | 1006 | | |
1000 | 1007 | | |
1001 | 1008 | | |
1002 | | - | |
1003 | | - | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1004 | 1017 | | |
| 1018 | + | |
1005 | 1019 | | |
1006 | 1020 | | |
1007 | 1021 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
| |||
504 | 505 | | |
505 | 506 | | |
506 | 507 | | |
| 508 | + | |
507 | 509 | | |
508 | 510 | | |
509 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
510 | 515 | | |
511 | 516 | | |
512 | 517 | | |
| |||
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1363 | 1363 | | |
1364 | 1364 | | |
1365 | 1365 | | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1371 | 1376 | | |
1372 | 1377 | | |
1373 | 1378 | | |
| |||
1541 | 1546 | | |
1542 | 1547 | | |
1543 | 1548 | | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1552 | 1560 | | |
1553 | 1561 | | |
1554 | 1562 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
| 294 | + | |
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
| |||
297 | 300 | | |
298 | 301 | | |
299 | 302 | | |
300 | | - | |
| 303 | + | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
227 | 253 | | |
228 | 254 | | |
229 | 255 | | |
| |||
Lines changed: 26 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
420 | 428 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
426 | 447 | | |
427 | 448 | | |
428 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
469 | 477 | | |
470 | 478 | | |
471 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
89 | 106 | | |
90 | 107 | | |
91 | 108 | | |
| |||
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
100 | 124 | | |
101 | 125 | | |
102 | 126 | | |
| |||
0 commit comments