Skip to content

fix(promptcontract): own provisioning inputs and clean publication losers - #959

Closed
Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/prompt-contract-operations
Closed

Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/prompt-contract-operations

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Prompt artifact work now owns the inputs it retains, validates every joining manifest, and removes its staging directory when another cache instance publishes first. Previously caller mutation could change a queued contract's files or configured origin, an invalid follower could reuse a valid leader's result without aggregate verification, and a publication loser could retain read-only temporary directories.

The API currently builds fresh manifests; the mutation fixtures demonstrate ownership-contract defects, not an observed production incident. Catalog reconciliation now clones nested file lists, cache construction snapshots the validated origin, and each caller checks its own aggregate before singleflight. Publication losers use the existing scoped writable cleanup and preserve the immutable winner. The supervisor's duplicate backoff branches and preload's repeated unavailable-state clearing are consolidated without changing their policies. Production source is +4 lines overall; the improvement is explicit ownership and less repeated control flow.

flowchart TB
  subgraph Before
    B1[Caller-owned URL and manifest file list] --> B2[Cache and Provisioner retain aliases]
    B2 --> B3[Later mutation can change download or contract path]
    B4[Ensure follower] --> B5[Join before aggregate verification]
    B6[Publication loses race] --> B7[Ignore removal error and skip deferred cleanup]
    B7 --> B8[Read-only staging can remain]
    B9[runChild ran flag] --> B10[Two identical backoff branches]
  end
  subgraph After
    A1[NewArtifactCache and Reconcile] --> A2[Own URL value and each file list]
    A2 --> A3[Stable origin and queued contract identity]
    A4[Ensure each caller] --> A5[Validate aggregate then join]
    A6[Publication loses race] --> A7[Verify winner and defer owned staging cleanup]
    A7 --> A8[Immutable winner retained; duplicate removed]
    A9[runChild lifecycle result] --> A10[One unchanged backoff path]
  end
Loading

Validation on Go 1.25.0:

  • Four offline regression cases failed before their fixes: mutated origin, queued file-list mutation, competing read-only publication, and invalid singleflight follower. They use owned temporary roots and local HTTP fixtures.
  • go test -race ./promptcontract -count=1: PASS, 4.177s. Includes existing endpoint/hash vectors, cancellation, socket client, provisioning, preload and synthetic supervisor-child tests.
  • go test -race ./api -run '^TestCatalogReconcileProvisionsPromptArtifacts$' -count=1: PASS, 1.681s.
  • scripts/docs-check.sh: PASS, 278 files. git diff --check: PASS.
  • Independent source and regression-test review: clean. No provider, Swift, model, deployment or real artifact download executed; no timed fuzz campaign.

Source reviewed: all nine assigned Go artifact/client/endpoint/preload/provisioner/date/supervisor operation files and direct tests; unchanged endpoint lowering and hash fixtures preserve their existing byte contracts. Canonical documentation is stamped against reachable source commit 4a3c92016.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 12, 2026 1:08am UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 1:08am UTC
d-inference-landing Ready Ready Preview Sep 12, 2026 1:08am UTC

Request Review

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T21:49:28.396496Z b203b2e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: b203b2ef13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1056 for review and merge after #1094, #1095 and #1096. #1056 contains this branch's exact head (b203b2ef136adf7c4c8c2eb1802c70cb55d061c3), including its reviewed fixes, with implementations and regressions reconciled into the coordinator subsystem owners. Closing the component PR to collapse the stack; its branch, commits and review history are retained. Follow #1056 for combined validation and merge status.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference-console-ui-dev — b203b2ef Deployed Sep 12, 2026 by vercel[bot]
benchmarks — b203b2ef Deployed Sep 12, 2026 by Gajesh2007 via E2E Benchmarks #1051
Preview – d-inference — b203b2ef Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-landing — b203b2ef Deployed Sep 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant