Repository navigation
Add dormant Pack worker fences and durable receipt ordering #1286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sidneyswift
wants to merge
5
commits into
main
Choose a base branch
from
codex/pack-worker-fence-2269
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
75ee4c6
Add dormant Pack execution fences and durable receipt ordering
sidneyswift 47d04b9
Run Pack fence qualification without changing pinned package manifest
sidneyswift 0fecfb3
Merge remote-tracking branch 'origin/main' into codex/pack-worker-fen…
sidneyswift 0f5f2ff
Merge remote-tracking branch 'origin/main' into codex/pack-worker-fen…
sidneyswift ebd885f
fix(packs): retain acknowledged context fences through foundation bat…
sidneyswift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,35 @@ | ||
| import { assertPackExecutionIdentity } from "@/lib/content/packs/fence/assertPackExecutionIdentity"; | ||
| import type { PackLaunchFence } from "@/lib/content/packs/fence/packFenceTypes"; | ||
| import { PackFenceError } from "@/lib/content/packs/fence/PackFenceError"; | ||
| import { getWorkflowMetadata } from "workflow"; | ||
| import { runPackCommand } from "@/lib/supabase/release_pack_jobs/runPackCommand"; | ||
| import { preparePackProduction } from "@/lib/content/packs/preparePackProduction"; | ||
| import type { PackActor } from "@/lib/content/packs/packTypes"; | ||
| export async function preparePackStep(actor: PackActor, jobId: string) { | ||
| export async function preparePackStep( | ||
| actor: PackActor, | ||
| jobId: string, | ||
| execution?: PackLaunchFence, | ||
| ) { | ||
| "use step"; | ||
| if (actor.packProtocol === 2 && !execution) | ||
| throw new PackFenceError("Missing original launch identity"); | ||
| const workflowRunId = getWorkflowMetadata().workflowRunId; | ||
| await runPackCommand(actor, "run", jobId, { | ||
| workflow_run_id: getWorkflowMetadata().workflowRunId, | ||
| ...execution, | ||
| workflow_run_id: workflowRunId, | ||
| }); | ||
| const saved = await runPackCommand(actor, "read", jobId); | ||
| if (actor.packProtocol === 2) { | ||
| assertPackExecutionIdentity(saved.job, execution, workflowRunId); | ||
| if (saved.job.status !== "running") throw new PackFenceError("Pack no longer running"); | ||
| } | ||
| const job = await preparePackProduction(actor, saved.job); | ||
| return { job, assetIds: saved.assets.filter(a => a.status === "pending").map(a => a.id) }; | ||
| return { | ||
| job, | ||
| assetIds: saved.assets.filter(a => a.status === "pending").map(a => a.id), | ||
| ...(actor.packProtocol === 2 | ||
| ? { assetAttempts: Object.fromEntries(saved.assets.map(a => [a.id, a.attempt] as const)) } | ||
| : {}), | ||
| }; | ||
| } | ||
| preparePackStep.maxRetries = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,21 @@ | ||
| import { getWorkflowMetadata } from "workflow"; | ||
| import type { PackLaunchFence } from "@/lib/content/packs/fence/packFenceTypes"; | ||
| import { PackFenceError } from "@/lib/content/packs/fence/PackFenceError"; | ||
| import { runPackCommand } from "@/lib/supabase/release_pack_jobs/runPackCommand"; | ||
| import type { PackActor } from "@/lib/content/packs/packTypes"; | ||
| /** Unwired scheduler adapter: an ambiguous settlement requires reconciliation, not retry. */ | ||
| export async function settleBoundedPackStep(actor: PackActor, jobId: string, error?: string) { | ||
| /** Zero-retry adapter used by dormant protocol 2 and the unwired bounded scheduler: an ambiguous settlement requires reconciliation, not retry. */ | ||
| export async function settleBoundedPackStep( | ||
| actor: PackActor, | ||
| jobId: string, | ||
| error?: string, | ||
| execution?: PackLaunchFence, | ||
| ) { | ||
| "use step"; | ||
| return runPackCommand(actor, "settle", jobId, { error: error ?? null }); | ||
| if (actor.packProtocol === 2 && !execution) | ||
| throw new PackFenceError("Missing original settlement identity"); | ||
| return runPackCommand(actor, "settle", jobId, { | ||
| error: error ?? null, | ||
| ...(execution ? { ...execution, workflow_run_id: getWorkflowMetadata().workflowRunId } : {}), | ||
| }); | ||
| } | ||
| settleBoundedPackStep.maxRetries = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.