@opengeni/worker-bundle 0.11.1 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +22 -6
- package/dist/index.js +892 -317
- package/dist/index.js.map +1 -1
- package/dist/workflow-bundle.js +15 -12
- package/package.json +10 -10
- package/src/activities/agent-turn.ts +444 -146
- package/src/activities/capabilities.ts +19 -37
- package/src/activities/codex-capacity.ts +1 -1
- package/src/activities/redaction.ts +9 -56
- package/src/activities/sandbox-lease.ts +411 -0
- package/src/activities/types.ts +6 -6
- package/src/http.ts +14 -2
- package/src/index.ts +24 -2
- package/src/observability-metrics.ts +137 -0
- package/src/sandbox-resume.ts +33 -114
- package/src/sandbox-routing.ts +95 -30
- package/src/workflows/session.ts +14 -11
package/src/workflows/session.ts
CHANGED
|
@@ -296,9 +296,11 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
296
296
|
const capacityCheckBackstop =
|
|
297
297
|
input.maxCapacityChecksPerRun ?? CODEX_CAPACITY_CHECKS_PER_RUN_BACKSTOP;
|
|
298
298
|
if (workflowInfo().continueAsNewSuggested || capacityChecksThisRun >= capacityCheckBackstop) {
|
|
299
|
-
// The waiter
|
|
300
|
-
//
|
|
301
|
-
//
|
|
299
|
+
// The waiter and exact nonterminal turn are durable in Postgres, and
|
|
300
|
+
// the old attempt is already closed. A fresh workflow run reads the
|
|
301
|
+
// waiter before goal continuation, reconstructs its timer, and turns
|
|
302
|
+
// any unobserved wake revision into an immediate evaluation. This is
|
|
303
|
+
// an ownerless-attempt boundary, not a settled-turn boundary.
|
|
302
304
|
// A quiescence proof is the one signal that is not merely a replaceable
|
|
303
305
|
// wake hint. It may have arrived while the reconciliation activity was
|
|
304
306
|
// running, so commit it before crossing this nested continue-as-new
|
|
@@ -324,11 +326,12 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
324
326
|
// decision so no accepted physical fact can be dropped with run history.
|
|
325
327
|
await persistPendingQuiescenceProofs();
|
|
326
328
|
// History-overflow guard. The top of the loop is the only safe
|
|
327
|
-
// continueAsNew boundary: no
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
329
|
+
// continueAsNew boundary: no activity attempt owns a turn. A same logical
|
|
330
|
+
// turn may still be nonterminal (`recovering` or `waiting_capacity`), but
|
|
331
|
+
// its dispatch attempt has closed and all recovery/wait truth is durable
|
|
332
|
+
// in Postgres. Every interruption is already durable there too, so ordinary
|
|
333
|
+
// Temporal signals are replaceable wake hints and none must be carried into
|
|
334
|
+
// the next workflow run. A
|
|
332
335
|
// buffered userMessage/queueChanged signal only
|
|
333
336
|
// bumps `wakeups`, and its turn was written to Postgres BEFORE the signal
|
|
334
337
|
// was sent, so the fresh run observes it on its first durable work peek
|
|
@@ -604,9 +607,9 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
604
607
|
}
|
|
605
608
|
|
|
606
609
|
if (outcome.kind === "failure") {
|
|
607
|
-
// A capacity
|
|
608
|
-
// transport/worker failed. Recover that durable boundary
|
|
609
|
-
// failSession can overwrite the
|
|
610
|
+
// A capacity wait may have committed just before the activity
|
|
611
|
+
// transport/worker failed. Recover that durable same-turn boundary
|
|
612
|
+
// before generic failSession can overwrite the nonterminal turn.
|
|
610
613
|
{
|
|
611
614
|
const capacityWait = await activity.getCodexCapacityWait({
|
|
612
615
|
workspaceId,
|