Skip to content

fix(frontend): deployment "Last modified" shows the environment timestamp, not the deployed revision date #4592

Description

@mmabrouk

Summary

On the prompt Overview → Deployment card, the Last modified value shows the
environment record's timestamp instead of the date the deployed prompt revision was
actually created/deployed. As a result every environment can show the same, wrong date
(e.g. the date the project's environments were first created), which makes it hard to tell
what is actually deployed and when.

Root cause

The deployment view derives updatedAt from the environment object's own timestamp:

web/packages/agenta-entities/src/environment/state/appDeployments.ts

return {
    ...
    updatedAt: env.updated_at ?? env.created_at ?? null, // environment record's timestamp
}

and the card renders it as "Last modified":

web/oss/src/components/DeploymentsDashboard/components/DeploymentCard/index.tsx

const d = dayjs.utc(env.updatedAt)
// "Last modified" -> {lastModifiedText}

The simple-environment object's updated_at/created_at reflect the environment artifact,
not the deployment. They do not change when a new revision is deployed, so the displayed
date is unrelated to the deploy and is usually the environment's creation date.

Steps to reproduce

  1. Create a project (its environments are created once, with a fixed timestamp).
  2. Later, deploy a prompt revision to an environment.
  3. Open the prompt Overview. The Deployment card's "Last modified" shows the environment's
    original creation date, not the date of the deploy/revision.

Expected

"Last modified" should reflect the deployed revision (when the deployed prompt version
was created/committed), not the environment record's timestamp. Each environment should show
the date of whatever revision it currently has deployed.

Proposed fix

In toAppEnvironmentDeployment, set updatedAt from the deployed revision's date (resolve it
from the workflow entity for applicationRevision.id, the same lookup already used for the
variant-name fallback), and fall back to the environment timestamp only when the revision date
is unavailable. Add a unit test that asserts the date comes from the deployed revision.

(Backend note: the simple-environment updated_at could alternatively be populated from the
latest environment revision so it reflects the deploy; the frontend fix above does not depend
on that.)

Area

frontend / @agenta/entities (deployment views)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions