Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 loopx/control_plane/goals/vision_checkpoint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { JsonObject } from "../effect_program.ts";
import { EffectRuntimeRequestError } from "../effect_runtime_errors.ts";
import { isBoundedBlockedRetry } from "../quota/blocked_retry.ts";
import { isBoundedBlockedRetry } from "../quota/settlement_phase.ts";
import {
DELIVERY_BOUNDARIES,
type DeliveryBoundary,
Expand Down
15 changes: 0 additions & 15 deletions loopx/control_plane/quota/blocked_retry.ts

This file was deleted.

15 changes: 15 additions & 0 deletions loopx/control_plane/quota/settlement_phase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
import type { SettlementIdentity } from "../effect_program.ts";
import { jsonObject } from "../runtime_decode.ts";

/** A typed blocked Turn may close without spend only with a bounded retry. */
export function isBoundedBlockedRetry(value: unknown, todoId: string | null): boolean {
const retry = jsonObject(value);
if (!retry || retry.schema_version !== "quota_blocked_retry_v0" ||
(retry.source !== "todo" && retry.source !== "turn_settlement") ||
typeof todoId !== "string" || retry.todo_id !== todoId ||
typeof retry.observed_at !== "string" || typeof retry.due_at !== "string" ||
retry.resume_when !== `resume_at:${retry.due_at}`) return false;
const observed = Date.parse(retry.observed_at);
const due = Date.parse(retry.due_at);
const delay = (due - observed) / 1000;
return Number.isFinite(delay) && delay >= 60 && delay <= 30 * 60;
}

/** Both same-Turn readback and prior-Turn recovery accept the shipped effect identities. */
export function isCommittedMonitorPollEffect(
Expand Down
2 changes: 1 addition & 1 deletion loopx/control_plane/quota/settlement_readback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import {
type DeliveryWorkspaceCausality,
} from "./settlement_workspace_causality.ts";
import {
isBoundedBlockedRetry,
isCommittedMonitorPollEffect,
receiptBoundMonitorPhase,
receiptBoundReplayPhase,
} from "./settlement_phase.ts";
import { isTurnScopedSettlementOutcome } from "../work_items/delivery_outcome.ts";
import { isBoundedBlockedRetry } from "./blocked_retry.ts";
import {
decodeRefreshRetry,
isMaterialMonitorPoll,
Expand Down
Loading