feat: execute durable client commands through supervisor

This commit is contained in:
2026-09-06 12:18:15 +00:00
parent 3f84d3b2f1
commit 56b15c7f4f
41 changed files with 4272 additions and 66 deletions
+13
View File
@@ -16,6 +16,7 @@ type migration struct {
var migrations = []migration{
{version: 1, sql: schemaV1},
{version: 2, sql: schemaV2},
{version: 3, sql: schemaV3},
}
func applyMigrations(ctx context.Context, db *sql.DB) error {
@@ -132,3 +133,15 @@ CREATE TABLE command_specs (
charged_bytes INTEGER NOT NULL CHECK(charged_bytes > 0)
) STRICT, WITHOUT ROWID;
`
// schemaV3 adds a small durable launch barrier to every accepted command. A
// value of 2 means launch authorization may have crossed the OS boundary; on
// restart the client must interrupt that command instead of redispatching it.
// Keeping these fields on commands makes the barrier part of the existing
// command-owned quota/accounting row and lets terminal cleanup remove it with
// the command.
const schemaV3 = `
ALTER TABLE commands ADD COLUMN launch_phase INTEGER NOT NULL DEFAULT 0 CHECK(launch_phase BETWEEN 0 AND 2);
ALTER TABLE commands ADD COLUMN launch_context TEXT NOT NULL DEFAULT '';
ALTER TABLE commands ADD COLUMN launch_pid INTEGER NOT NULL DEFAULT 0 CHECK(launch_pid >= 0);
`