Skip to content

feat: add deployment history support#40

Open
ben-fowler-cloud wants to merge 4 commits into
env0:mainfrom
dbt-labs:feat/deployment-history-upstream
Open

feat: add deployment history support#40
ben-fowler-cloud wants to merge 4 commits into
env0:mainfrom
dbt-labs:feat/deployment-history-upstream

Conversation

@ben-fowler-cloud
Copy link
Copy Markdown

Summary

Adds the ability to query historical deployment data, not just the latest deployment per environment:

  • New tool: get-deployments — list deployments for an environment with optional filters (limit, offset, statuses). Returns deployment IDs usable with the other tools below.
  • get-plan-logs — new optional deploymentId parameter. When provided, fetches the plan step log for that specific deployment. When omitted, existing behavior (latest deployment) is preserved.
  • get-error-analysis — new optional deploymentId parameter. When provided, attempts deployment-specific error analysis with graceful fallback to environment-level. When omitted, existing behavior is preserved.

Motivation

The current MCP tools only expose the latest deployment per environment. When multiple deployments happen in quick succession (e.g., a PR plan followed by a master deploy), agents can only see the most recent one. This makes it impossible to investigate a specific PR deployment that has since been superseded — a common workflow when debugging failed plans.

New service methods

Method API Endpoint
getDeployments GET /environments/{envId}/deployments
getDeploymentSteps GET /deployments/{id}/steps
getDeploymentStepLog GET /deployments/{id}/steps/{name}/log

Backward compatibility

All changes are additive. Existing callers that omit deploymentId get identical behavior to the previous version. No breaking changes.

Test plan

  • get-deployments returns deployment history for an environment
  • get-deployments with limit and statuses filters works
  • get-plan-logs without deploymentId returns latest (unchanged behavior)
  • get-plan-logs with deploymentId returns plan step log for that specific deployment
  • get-error-analysis without deploymentId returns latest (unchanged behavior)
  • get-error-analysis with deploymentId attempts deployment-specific analysis
  • Build passes (npm run build)
  • Lint passes (npm run lint)

ben-fowler-cloud and others added 4 commits May 11, 2026 13:55
…n logs and error analysis)

New tool:
- get-deployments: list deployments for an environment with optional
  filters (limit, offset, statuses). Returns deployment IDs that can
  be used with get-plan-logs and get-error-analysis.

Enhanced tools:
- get-plan-logs: optional deploymentId param. When provided, fetches
  steps for that deployment and returns the plan step log. When omitted,
  existing behavior (latest deployment) is preserved.
- get-error-analysis: optional deploymentId param. When provided,
  attempts deployment-specific error analysis with fallback to
  environment-level. When omitted, existing behavior is preserved.

New service methods:
- getDeployments: GET /environments/{envId}/deployments
- getDeploymentSteps: GET /deployments/{id}/steps
- getDeploymentStepLog: GET /deployments/{id}/steps/{name}/log

All changes are backward compatible — omitting deploymentId produces
identical behavior to the previous version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two fixes for large plan output:

1. getDeploymentStepLog now paginates through all pages using
   hasMoreLogs/nextStartTime instead of returning only page 1.

2. getPlanLogs no longer falls back to the /mcp/ convenience endpoint
   (which truncates with "Plan is too long"). Instead, when no
   deploymentId is provided, it resolves the latest deployment from
   the environment's latestDeploymentLogId and uses the step log
   API directly. This returns the full untruncated output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add get-deployment-steps tool to list steps (init, plan, apply) for a deployment
- Add get-deployment-step-log tool to fetch logs for any specific step
- Add tail parameter to get-plan-logs (default 150 events) to reduce response size
- get-deployment-step-log includes tail support with truncation metadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…leanup

- Strip `variables` array from environment responses (50%+ of payload,
  includes sensitive hashes that aren't useful to agents)
- Flatten `latestDeploymentLog` to 10 summary fields instead of full
  deployment record
- Collapse `providerVersions` to count + short names, `moduleVersions`
  to count only
- Strip ANSI escape codes from plan log messages (~15-20% noise reduction)
- Lower default tail from 150 to 50, include planSummary in truncated
  metadata so agents can assess scope before fetching more

Estimated ~40-50k token savings per environment+plan query.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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