The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as SqlClient from "effect/sql/SqlClient"; |
| 3 | |
| 4 | export default Effect.gen(function* () { |
| 5 | const sql = yield* SqlClient.SqlClient; |
| 6 | |
| 7 | // Usage-limit recovery scans every thread's failures. The latest executed run lookup it |
| 8 | // joins is already served by 084's orchestration_v2_projection_runs_last_executed_idx. |
| 9 | // Keep this predicate identical to ProjectionStore's usage-limit recovery filter. |
| 10 | // json_valid keeps a malformed payload writable, as the other payload indexes do. |
| 11 | yield* sql` |
| 12 | CREATE INDEX IF NOT EXISTS orchestration_v2_projection_turn_items_usage_limit_idx |
| 13 | ON orchestration_v2_projection_turn_items(thread_id) |
| 14 | WHERE type = 'error' AND status = 'failed' |
| 15 | AND CASE WHEN json_valid(payload_json) THEN |
| 16 | json_extract(payload_json, '$.failure.class') = 'usage_limit' |
| 17 | ELSE 0 END |
| 18 | `; |
| 19 | }); |