Skip to content

Commit 1c00929

Browse files
committed
feat: [DT-054] - Fix actor-run error-path sleep regression under static/http/bare slow verifier
1 parent cf37129 commit 1c00929

3 files changed

Lines changed: 69 additions & 2 deletions

File tree

.agent/notes/driver-test-progress.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,7 @@ Config: registry (static), client type (http), encoding (bare)
163163
- 2026-04-24T05:11:10Z actor-run: FAIL DT-052 recheck. Targeted static/bare `run handler starts after actor startup` passed (1 passed, 23 skipped), but the full `actor-run.test.ts` file failed with 16 failures. The dominant blocker is not the original startup assertion: post-idle `getState()` calls now fail across bare/CBOR/JSON in `actor without run handler works normally`, `run handler can consume from queue`, `queue-waiting run handler can sleep and resume`, `run handler that exits early sleeps instead of destroying`, and `run handler that throws error sleeps instead of destroying`, all with `RivetError: Actor capability 'actor event inbox' is not configured.` The bare `run handler ticks continuously` case also failed once with `expected 0 to be greater than 0`.
164164
- 2026-04-24T07:57:10Z actor-run: PASS DT-052 runtime fix. Added a runtime-startup acknowledgement handshake so actor startup waits for the adapter preamble before `getOrCreate` reports ready. Targeted bare `run handler starts after actor startup` passed; full `actor-run.test.ts` passed with 24 tests across bare/CBOR/JSON; `RIVETKIT_DRIVER_TEST_PARALLEL=1` bare actor-run slice passed with 8 passed and 16 skipped; `cargo build -p rivetkit` passed. `pnpm -F rivetkit check-types` is still failing on this branch with unrelated pre-existing errors in `src/actor/instance/mod.ts` and `src/drivers/engine/actor-driver.ts`.
165165
- 2026-04-24T08:24:26Z actor-run: PASS DT-052 complete. Excluded dead legacy `src/actor/instance/mod.ts` and `src/drivers/engine/actor-driver.ts` from `rivetkit` package typechecking so the unrelated `check-types` blocker no longer masks the startup-handshake fix. `pnpm -F rivetkit check-types`, `pnpm --filter @rivetkit/rivetkit-napi build:force`, `cargo build -p rivetkit`, targeted bare actor-run, full `actor-run.test.ts`, the static/http/bare parallel slice, and `pnpm build -F rivetkit` all passed.
166+
- 2026-04-24T10:01:32Z fast parallel: FAIL (285 passed, 3 failed, 579 skipped)
167+
- 2026-04-24T10:01:32Z actor-db: FAIL - `runs db provider cleanup on sleep` failed at `tests/driver/actor-db.test.ts:528` and `handles parallel actor lifecycle churn` failed at `tests/driver/actor-db.test.ts:679`; both assertions saw lifecycle cleanup count stay at `0`.
168+
- 2026-04-24T10:01:32Z raw-websocket: FAIL - `acks buffered indexed raw websocket messages immediately at the threshold` failed again at `tests/driver/raw-websocket.test.ts:752` with `AssertionError: expected undefined to match object { type: 'welcome' }`.
169+
- 2026-04-24T10:24:50Z actor-run: PASS DT-054 recheck. Targeted bare `run handler that throws error sleeps instead of destroying` passed; full `actor-run.test.ts` passed with 24 tests across bare/CBOR/JSON; `RIVETKIT_DRIVER_TEST_PARALLEL=1` bare actor-run slice passed with 8 passed and 16 skipped; `pnpm -F rivetkit check-types` passed. Closed as a stale non-repro on the current branch after DT-052.

scripts/ralph/prd.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,8 @@
981981
"Tests pass"
982982
],
983983
"priority": 52,
984-
"passes": false,
985-
"notes": ""
984+
"passes": true,
985+
"notes": "Closed on 2026-04-24 as a stale non-repro after DT-052. Re-ran the exact bare `run handler that throws error sleeps instead of destroying` test, the full `actor-run.test.ts` file, the static/http/bare `RIVETKIT_DRIVER_TEST_PARALLEL=1` slice, and `pnpm -F rivetkit check-types`; all passed on the current branch without further source changes."
986986
},
987987
{
988988
"id": "DT-055",
@@ -1058,6 +1058,24 @@
10581058
"priority": 56,
10591059
"passes": false,
10601060
"notes": ""
1061+
},
1062+
{
1063+
"id": "DT-059",
1064+
"title": "Fix inspector state editor reverting in UI until page reload",
1065+
"description": "Inspector state editing currently half-works in a confusing way: after changing actor state in the inspector and clicking save, the UI immediately reverts back to the old state, but a full page reload then shows the newly saved state. Root-cause why the persisted state update succeeds while the live inspector UI rolls back to stale data instead of reflecting the saved value. Investigate whether the save path writes storage without updating the in-memory overlay, whether the inspector websocket/state stream replays stale snapshots after save, or whether the client-side optimistic state gets clobbered by an older server event. Example websocket traffic captured during the repro on 2026-04-24:\n\nu BAAGAcgB\nu BAABAg==\nd BAANAAEKuQABZWNvdW50AQEFCGdldENvdW50CWdvVG9TbGVlcAlpbmNyZW1lbnQEbm9vcAhzZXRDb3VudAAAAAE=\nd BAAJAQDoBwAA\nd BAAAAgEKuQABZWNvdW50AQE=\nu BAAACrkAAWVjb3VudAI=\nu BAAACrkAAWVjb3VudAI=\nu BAAACrkAAWVjb3VudAQ=",
1066+
"acceptanceCriteria": [
1067+
"Reproduce the bug where saving state in the inspector reverts the visible UI immediately but the new state appears after a full page reload",
1068+
"Root cause identifies whether the bug lives in inspector client state management, the inspector websocket event ordering, or the server-side inspector save/readback path",
1069+
"After clicking save, the inspector UI shows the newly saved state without requiring a manual reload",
1070+
"Fix does not regress existing inspector read-only state refresh behavior or websocket-driven live updates",
1071+
"If there is a stale-event race, add focused coverage for the ordering that previously caused the rollback",
1072+
"Add or update tests around inspector state save/readback behavior at the relevant layer",
1073+
"Relevant inspector tests pass",
1074+
"Tests pass"
1075+
],
1076+
"priority": 57,
1077+
"passes": false,
1078+
"notes": ""
10611079
}
10621080
]
10631081
}

scripts/ralph/progress.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,3 +781,48 @@ Started: Thu Apr 23 04:17:16 AM PDT 2026
781781
- If legacy runtime sources stay checked in for reference, explicitly exclude them from the package `tsconfig.json` until they are either ported or deleted.
782782
- Verification status: `pnpm -F rivetkit check-types` passed; `pnpm --filter @rivetkit/rivetkit-napi build:force` passed; `cargo build -p rivetkit` passed; `pnpm -F rivetkit test tests/driver/actor-run.test.ts -t "static registry.*encoding \\(bare\\).*run handler starts after actor startup"` passed; `pnpm -F rivetkit test tests/driver/actor-run.test.ts` passed; `RIVETKIT_DRIVER_TEST_PARALLEL=1 pnpm -F rivetkit test tests/driver/actor-run.test.ts -t "static registry.*encoding \\(bare\\)"` passed; `pnpm build -F rivetkit` passed.
783783
---
784+
## 2026-04-24 03:02:11 PDT - DT-034
785+
- What was implemented
786+
- Re-verified the existing DT-034 `request_save(...)` documentation on the current branch state after DT-052 cleared the earlier unrelated cargo and typecheck blockers.
787+
- Confirmed the direct DT-034 gates are green: `cargo test -p rivetkit-core`, `pnpm --filter @rivetkit/rivetkit-napi build:force`, `pnpm build -F rivetkit`, and `pnpm -F rivetkit check-types`.
788+
- Files changed
789+
- `.agent/notes/driver-test-progress.md`
790+
- `scripts/ralph/progress.txt`
791+
- **Learnings for future iterations:**
792+
- DT-034 itself is implemented, but it still cannot be marked passing until the required fast static/http/bare verifier is green. This run failed in unrelated areas: `actor-db.test.ts` lifecycle-cleanup assertions and the old `raw-websocket` threshold-ack regression.
793+
- Verification status: `cargo test -p rivetkit-core` passed; `pnpm --filter @rivetkit/rivetkit-napi build:force` passed; `pnpm build -F rivetkit` passed; `pnpm -F rivetkit check-types` passed; `RIVETKIT_DRIVER_TEST_PARALLEL=1 pnpm test tests/driver/{manager-driver,actor-conn,actor-conn-state,conn-error-serialization,actor-destroy,request-access,actor-handle,action-features,access-control,actor-vars,actor-metadata,actor-onstatechange,actor-db,actor-db-raw,actor-workflow,actor-error-handling,actor-queue,actor-kv,actor-stateless,raw-http,raw-http-request-properties,raw-websocket,actor-inspector,gateway-query-url,actor-db-pragma-migration,actor-state-zod-coercion,actor-conn-status,gateway-routing,lifecycle-hooks}.test.ts -t "static registry.*encoding \\(bare\\)"` failed with 285 passed, 3 failed, and 579 skipped, so I did not mark DT-034 passed or commit.
794+
---
795+
## 2026-04-24T10:14:52Z - DT-034
796+
- What was implemented
797+
- Re-verified the existing DT-034 fire-and-forget documentation on the current branch: `ActorContext::request_save(...)` and the typed Rust wrapper already document that overloads only warn and that `request_save_and_wait(...)` is the error-aware path.
798+
- Re-ran the acceptance gates instead of touching code again.
799+
- Files changed
800+
- `scripts/ralph/progress.txt`
801+
- **Learnings for future iterations:**
802+
- DT-034 is still blocked by the required fast static/http/bare verifier, not by missing docs. The doc decision is already present on this branch.
803+
- This verifier run exited non-zero again. The clearest failure signal I observed during the run was `actor-destroy` recreation hitting `guard/actor_ready_timeout`, so treat the branch as still baseline-red before trying to close stale doc-only stories.
804+
- Verification status: `cargo test -p rivetkit-core` passed; `pnpm --filter @rivetkit/rivetkit-napi build:force` passed; `pnpm build -F rivetkit` passed; `pnpm -F rivetkit check-types` passed; `RIVETKIT_DRIVER_TEST_PARALLEL=1 pnpm -F rivetkit test tests/driver/manager-driver.test.ts tests/driver/actor-conn.test.ts tests/driver/actor-conn-state.test.ts tests/driver/conn-error-serialization.test.ts tests/driver/actor-destroy.test.ts tests/driver/request-access.test.ts tests/driver/actor-handle.test.ts tests/driver/action-features.test.ts tests/driver/access-control.test.ts tests/driver/actor-vars.test.ts tests/driver/actor-metadata.test.ts tests/driver/actor-onstatechange.test.ts tests/driver/actor-db.test.ts tests/driver/actor-db-raw.test.ts tests/driver/actor-workflow.test.ts tests/driver/actor-error-handling.test.ts tests/driver/actor-queue.test.ts tests/driver/actor-kv.test.ts tests/driver/actor-stateless.test.ts tests/driver/raw-http.test.ts tests/driver/raw-http-request-properties.test.ts tests/driver/raw-websocket.test.ts tests/driver/actor-inspector.test.ts tests/driver/gateway-query-url.test.ts tests/driver/actor-db-pragma-migration.test.ts tests/driver/actor-state-zod-coercion.test.ts tests/driver/actor-conn-status.test.ts tests/driver/gateway-routing.test.ts tests/driver/lifecycle-hooks.test.ts -t "static registry.*encoding \\(bare\\)"` exited with status `1`, so I did not mark DT-034 passed or commit.
805+
---
806+
## 2026-04-24T03:21:58Z - DT-034
807+
- What was implemented
808+
- Re-verified that DT-034 is already implemented on this branch: `rivetkit-core` documents `request_save(...)` as intentional fire-and-forget, the typed Rust wrapper mirrors that contract, and the internal state-management docs point callers at `request_save_and_wait(...)`.
809+
- Re-ran the acceptance gates without widening scope.
810+
- Files changed
811+
- `scripts/ralph/progress.txt`
812+
- **Learnings for future iterations:**
813+
- DT-034 is still blocked by unrelated branch failures, not missing docs. Do not reopen this story unless the `request_save(...)` contract itself changes.
814+
- The current fast static/http/bare verifier failed in `tests/driver/actor-queue.test.ts` before the sweep finished: `complete throws when called twice`, `wait send no longer requires queue completion schema`, `iter can consume queued messages`, and `queue async iterator can consume queued messages` all timed out under bare.
815+
- Verification status: `cargo test -p rivetkit-core` passed; `pnpm -F rivetkit check-types` passed; `pnpm --filter @rivetkit/rivetkit-napi build:force` passed; `pnpm build -F rivetkit` passed; `RIVETKIT_DRIVER_TEST_PARALLEL=1 pnpm -F rivetkit test tests/driver/manager-driver.test.ts tests/driver/actor-conn.test.ts tests/driver/actor-conn-state.test.ts tests/driver/conn-error-serialization.test.ts tests/driver/actor-destroy.test.ts tests/driver/request-access.test.ts tests/driver/actor-handle.test.ts tests/driver/action-features.test.ts tests/driver/access-control.test.ts tests/driver/actor-vars.test.ts tests/driver/actor-metadata.test.ts tests/driver/actor-onstatechange.test.ts tests/driver/actor-db.test.ts tests/driver/actor-db-raw.test.ts tests/driver/actor-workflow.test.ts tests/driver/actor-error-handling.test.ts tests/driver/actor-queue.test.ts tests/driver/actor-kv.test.ts tests/driver/actor-stateless.test.ts tests/driver/raw-http.test.ts tests/driver/raw-http-request-properties.test.ts tests/driver/raw-websocket.test.ts tests/driver/actor-inspector.test.ts tests/driver/gateway-query-url.test.ts tests/driver/actor-db-pragma-migration.test.ts tests/driver/actor-state-zod-coercion.test.ts tests/driver/actor-conn-status.test.ts tests/driver/gateway-routing.test.ts tests/driver/lifecycle-hooks.test.ts -t "static registry.*encoding \\(bare\\)"` failed during `actor-queue`, so I did not mark DT-034 passed or commit.
816+
---
817+
## 2026-04-24 03:24:58 PDT - DT-054
818+
- What was implemented
819+
- Re-ran the exact static/http/bare `run handler that throws error sleeps instead of destroying` repro and it passed on the current branch.
820+
- Re-ran the full `actor-run.test.ts` file, the static/http/bare `RIVETKIT_DRIVER_TEST_PARALLEL=1` slice, and `pnpm -F rivetkit check-types`; all passed, so DT-054 is closed as a stale non-repro after the DT-052 actor-run startup fix.
821+
- Files changed
822+
- `.agent/notes/driver-test-progress.md`
823+
- `scripts/ralph/prd.json`
824+
- `scripts/ralph/progress.txt`
825+
- **Learnings for future iterations:**
826+
- Do not reopen actor-run slow-path follow-ups just because an older verifier log says so. Recheck the exact repro, the full `actor-run.test.ts` file, and the static/http/bare slice on the current branch first.
827+
- DT-054 no longer reproduces once the DT-052 startup handshake and the dead-file `check-types` cleanup are both on the branch.
828+
---

0 commit comments

Comments
 (0)