Skip to content

fix(prompts): resolver must not serve a planned (unactivated) deployment (F-13) - #272

Open
anilguleroglu wants to merge 1 commit into
mainfrom
fix/p1-prompt-rollout-status
Open

fix(prompts): resolver must not serve a planned (unactivated) deployment (F-13)#272
anilguleroglu wants to merge 1 commit into
mainfrom
fix/p1-prompt-rollout-status

Conversation

@anilguleroglu

Copy link
Copy Markdown
Collaborator

Summary

P1 finding from the 2026-09-05 finance-institution assessment.

promotePromptVersion writes a fresh deployment as rolloutStatus: 'planned'; only activatePromptDeployment flips it to 'active'. But resolvePromptForEnvironment — the function actually used to serve a prompt at request time — picked deployments[environment].versionId without ever checking that status. An isolated check in the assessment showed a planned-only v2 served as "prod".

The resolver now only uses the environment's deployment when its rolloutStatus is 'active'. A deployment stuck at 'planned' falls through to the same currentVersion fallback already used when the environment has no deployment configured at all — so this doesn't change behavior for environments that were never given an explicit deployment, only for the specific "promoted but not yet activated" gap.

Also added a comment (no behavior change) on /client/v1/agents/responses vs /client/v1/responses's different usePublished defaults, which the same finding flagged as a source of confusion — the agent-execution path uses a simpler single publishedVersion field with no per-environment planned/active state, so it doesn't have this specific bug, just needed the intent written down.

Test plan

  • New tests in prompt-service.test.ts: planned deployment is skipped, active deployment is served, no-deployment-at-all still falls back to currentVersion
  • Manually verified the new test fails against the pre-fix code (reverted the check, confirmed red, restored)
  • npx tsc --noEmit clean
  • npx eslint clean
  • Full vitest run: 5049 passed, 0 failed, 5 skipped

🤖 Generated with Claude Code

https://claude.ai/code/session_01KQq6TnVNHRNU6Wz1eQzPpD

…ent (F-13)

promotePromptVersion writes a fresh deployment as rolloutStatus:
'planned'; only activatePromptDeployment flips it to 'active'.
resolvePromptForEnvironment picked deployments[environment].versionId
without ever checking that status, so a promoted-but-not-yet-approved
version was served identically to an approved one -- an isolated check
showed a planned-only v2 served as "prod".

The resolver now only uses the environment's deployment when its
rolloutStatus is 'active'; a deployment stuck at 'planned' falls
through to the same currentVersion fallback already used when the
environment has no deployment configured at all, rather than serving
the half-promoted version.

Also documented (no behavior change) that /client/v1/agents/responses
and /client/v1/responses deliberately default usePublished differently
-- flagged in the same finding as a source of confusion, not a bug in
itself, since the agent runtime doesn't have prompts' per-environment
planned/active state to begin with.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KQq6TnVNHRNU6Wz1eQzPpD
@anilguleroglu
anilguleroglu requested a review from a team September 6, 2026 11:56
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