Repository navigation
fix(server): make provider-sync reloads truthful about applied engine state - #4880
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Passed · 12/12 tests · 18/18 assertions · 8 images Commit |
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (195354 ms), confidentiality-review (245271 ms), spec-provenance-review (261166 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (e2f9f1d9b7288bbe29b6818ad786569065539bde). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
… state - engine-pool: forceStandby bypasses the unchanged-fingerprint guard so a credential-only rotation (invisible to the config fingerprint) produces an applied rollover instead of a skipped ack - engine-pool: a failed or hung standby seed no longer flips the pool; the standby is closed, the primary keeps serving and the rollover rejects (bounded by OPENWORK_ENGINE_STANDBY_PREPARE_TIMEOUT_MS) - engine-pool: requests coalesced into an in-flight rollover settle with the queued rollover's outcome instead of an immediate coalesced ack - managed-provider-auth: bounded timeout on engine auth PUT/DELETE - server: reloadOpencodeEngine returns the RolloverOutcome; a standby with failed credential seeds is not promoted - cloud-provider-sync: reloadPending clears only on an applied outcome; skipped/coalesced stay pending and retry, skipped marks the run failed Coverage: engine-pool, managed-provider-auth, reload-guard, drain-defer unit owners extended; managed-provider-env-delivery-reload boundary spec gains a real managed v1 engine key-only rotation witness.
…ter deletion The restart recovery reused a predicate requiring both originally published providers, one of which the journey deletes earlier, so a correct server could never satisfy it. Terminal status now requires the currently assigned providers present, the deleted provider absent, and no reload pending.
…tions A key-only rotation through PUT /env never shows in the pool's config fingerprint, so the unforced rollover request was skipped while the route reported the reload as done and the engine kept the previous credential. Force the standby path like cloud sync does, and only answer reloaded once the pool applied the change; otherwise keep the reload owed for the sync retry. Extends the key-rotation journey with the local route and aligns the Gateway sync fixture with the RolloverOutcome contract.
e2f9f1d to
0d12b09
Compare
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (0d12b096940d928dbe318a14cc5539675d0b892c). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Problem
After a managed provider's API key was rotated, the server could report the reload as done while the engine kept serving with the previous key. Every following run failed with an auth error from the provider while the sync status said
appliedandreloadPending: false.Root cause: the engine pool decides whether a reload is needed from a fingerprint of the config bytes, binary, and models URL. Credentials are not part of that fingerprint, so a key-only change looked like "nothing changed" and the rollover was skipped. Callers then cleared their pending state without checking what the pool actually did.
Fix
One behaviour, applied consistently: a reload is only reported as applied when the engine actually read the new config and credentials.
EnginePool.requestRolloverhonoursforceStandbyeven when the fingerprint is unchanged, since the caller knows an input the fingerprint cannot see has changed.reloadOpencodeEnginereturns theRolloverOutcomeinstead ofvoid; cloud sync clearsreloadPendingonly onrolled_over/reloaded_in_place, keeps it owed and retries oncoalesced, and fails the run and retries onskipped.coalescedimmediately.OPENWORK_PROVIDER_AUTH_TIMEOUT_MS), standby preparation a 30 s budget (OPENWORK_ENGINE_STANDBY_PREPARE_TIMEOUT_MS).PUT /envroute (applyManagedProviderReload) had the same gap: it requested an unforced rollover and answeredreloaded. It now forces the standby path and reportsdeferred(with the reload kept pending for the sync retry) when the pool did not apply the change.cloud-provider-sync-contract.e2eterminal predicate no longer requires a provider the journey deletes.Proof (head of this PR, rebased on
devf128bff74)pnpm evals:pr specs/managed-provider-env-delivery-reload.test.tsserver.ts::455 expected [ {…}, {…} ] to deeply equal [](twokind: "error"witness requests after thePUT /envrotation, engine still sent the revoked key)pnpm evals:pr specs/opencode-v2-provider-hot-inject.test.tsbun test src/engine-pool.test.tsbun test src/managed-provider-auth.test.tsbun test src/cloud-provider-sync-reload-guard.test.tsbun test src/cloud-provider-sync-drain-defer.test.tsbun test src/cloud-provider-sync.e2e.test.tspnpm --filter openwork-server typecheckThe key-rotation journey runs a real managed v1 engine against an
mcpMockprovider witness that accepts exactly one bearer key at a time. It rotates the key twice with identical provider config bytes: once through Den sync, once through the localPUT /envroute. Each rotation must produce a new engine generation, a completed reply with the new key, and zero requests carrying the revoked key.Verdict: Incomplete.
cloud-provider-sync-contract.e2e(the predicate fix) needs a Den + Electron lane run (pnpm evals:e2e cloud-provider-sync-contract) that has not been executed. Everything else above is passing at this head.Rebase notes
Rebased onto current
devafter #4358 (Gateway providers), #4876 and #4888 touched the same files. The fingerprint-skip exemption was re-applied by hand to the new per-directoryreloadedDirectoriescheck. The Gateway sync test fixtures were aligned with thePromise<RolloverOutcome>contract.Deferred
UI/UX impact: None — server-only change, existing UI/UX preserved.