Skip to content

Fix sessions hidden by reused preview deployments - #856

Merged
motatoes merged 2 commits into
mainfrom
fix/session-environment-filter
Oct 8, 2026
Merged

motatoes merged 2 commits into
mainfrom
fix/session-environment-filter

Conversation

@motatoes

@motatoes motatoes commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The project Sessions page inferred a session's environment from its deployment's creation alias. When a main build reused an identical preview artifact, the active default deployment retained its original pr-3 provenance label, so valid default sessions disappeared from the list.

Fix

  • Filter the Sessions page by the environment recorded on each session.
  • Fall back to deployment aliases only for legacy rows without a recorded environment.
  • Keep preview playground history filtered by deployment alias, since pr-<n> is a deployment target rather than an environment.

Verification

  • npm test -- --run src/managed-agents/session-history.test.ts — 11 passing
  • npm run typecheck — passing
  • Prettier check for changed files — passing
  • Regression covers a default session backed by a deployment labelled pr-3.

Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment thread web/src/managed-agents/Detail.tsx Outdated
}
const environmentSessions = project
? sessionsForEnvironment(
? sessionsForDeploymentAlias(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Default playground sessions disappear after preview reuse

When a default playground session uses a reused preview deployment, environmentSessions excludes it because the deployment retains its preview alias. The session disappears from playground history despite recording default as its environment.

Learn more

Playground history uses the agent's newest session summaries. A deployment can retain its original pr-3 alias after becoming active in the default environment. The alias-only filter excludes sessions created through the default playground on that deployment, even though their summaries record environment: 'default'. The project Sessions tab does not offer an alternate way to find them because it explicitly excludes playground sessions at externalSessions.

Example: Deployment preview-3 has alias pr-3 and becomes active in default. A playground session on default records environment: 'default' and deploymentId: 'preview-3'. The default playground requests alias default, so the filter drops that session instead of displaying it.

Recommended fix: For non-preview playground targets, filter recorded session environments as sessionsForEnvironment does, retaining the legacy fallback for null environments. Keep preview targeting separate; a deployment's immutable alias alone cannot distinguish preview history when the same deployment is reused across targets.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8de575a. Normal/default playground history now filters by the recorded session environment; deployment-alias filtering is used only when an explicit PR preview alias is selected. Focused tests, typecheck, and formatting pass.

@motatoes
motatoes merged commit 84be011 into main Oct 8, 2026
4 checks passed
@motatoes
motatoes deleted the fix/session-environment-filter branch October 8, 2026 02:36
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