Skip to content

[#4592] fix(frontend): deployment "Last modified" shows the deployed revision date - #4593

Merged
bekossy merged 2 commits into
release/v0.103.1from
fix/deployment-last-modified-date
Jun 10, 2026
Merged

[#4592] fix(frontend): deployment "Last modified" shows the deployed revision date#4593
bekossy merged 2 commits into
release/v0.103.1from
fix/deployment-last-modified-date

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Jun 9, 2026

Copy link
Copy Markdown
Member

What was wrong

On the prompt Overview → Deployment card, Last modified showed the wrong date, usually far in the past, so you could not tell when a prompt was actually deployed. A project whose environments were all created on one day showed that same creation date for every environment's deployment, no matter when each revision was actually deployed.

Cause

The date came from the environment record's own timestamp:

updatedAt: env.updated_at ?? env.created_at ?? null

A simple-environment's updated_at/created_at track the environment artifact. They do not change when a new revision is deployed, so the displayed date was unrelated to the deploy (usually the environment's creation date).

Fix

appEnvironmentsQueryAtomFamily now resolves the deployed revision reactively from the raw revision query (workflowMolecule.atoms.query(revisionId).data, the same source the Registry "Created on" column uses) and "Last modified" uses that revision's commit date.

Precedence (in resolveDeploymentLastModified): revision.created_atrevision.updated_atenv.updated_atenv.created_at.

Two details that matter:

  • We read the raw revision query, not workflowMolecule.get.data(). The latter returns a merged server+draft object whose created_at is the artifact's creation date, not the revision's commit date.
  • The read is reactive (get(...) inside the derived atom), so the date re-derives when the revision loads instead of reading a stale imperative snapshot.

Before / After

Before After
Deployment card "Last modified" environment record timestamp (wrong, static) deployed revision's commit date

Verification

  • Unit test for the precedence (resolveDeploymentLastModified), 6 cases.
  • tsc --noEmit and eslint clean on the changed files.
  • Verified live: the card shows the deployed revision's date, stable across reloads, with no regression to the environment status dot.

Scope: @agenta/entities only (two files).

Closes #4592

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 10, 2026 12:34pm

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Report Something isn't working Frontend labels Jun 9, 2026
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved accuracy of deployment "last modified" timestamp calculation to ensure correct revision timestamps are displayed when available.
  • Tests

    • Added test coverage for deployment timestamp resolution logic with various timestamp scenarios.

Walkthrough

The PR fixes deployment "Last modified" display by introducing timestamp precedence logic that prefers deployed revision dates over environment record timestamps. A new resolveDeploymentLastModified helper implements the date priority rules, toAppEnvironmentDeployment now accepts and uses revision data, and the query atom reactively resolves deployed revisions per environment.

Changes

Deployment timestamp precedence

Layer / File(s) Summary
Timestamp resolution helper and function signature
web/packages/agenta-entities/src/environment/state/appDeployments.ts
Added Workflow type import and introduced resolveDeploymentLastModified helper that implements date precedence rules (revision created_at > revision updated_at > env updated_at > env created_at). Updated toAppEnvironmentDeployment to accept revisionData parameter and apply the helper to compute updatedAt field instead of reading environment timestamps directly.
Reactive revision resolution in query atom
web/packages/agenta-entities/src/environment/state/appDeployments.ts
Updated appEnvironmentsQueryAtomFamily to derive the deployed revisionId from each environment, fetch revisionData reactively via workflowMolecule.atoms.query, and pass both the revision data and environment into toAppEnvironmentDeployment for proper timestamp computation. Previously, the function was called without revision context, so deployments always fell back to environment timestamps.
Unit tests for timestamp resolution
web/packages/agenta-entities/tests/unit/app-deployments.test.ts
Added Vitest suite for resolveDeploymentLastModified verifying date precedence across all branches: revision created_at preferred, fallback to revision updated_at, then environment updated_at, then environment created_at, and null when all are missing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Agenta-AI/agenta#4538: Both PRs modify web/packages/agenta-entities/src/environment/state/appDeployments.ts—the retrieved PR updates AppEnvironmentDeployment/toAppEnvironmentDeployment to include and map an environment slug, while the main PR changes toAppEnvironmentDeployment's behavior/signature around timestamp computation and revision resolution.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly indicates the main fix: the deployment 'Last modified' field now correctly shows the deployed revision date instead of the environment timestamp.
Description check ✅ Passed The description comprehensively explains the problem, root cause, and implemented solution with technical details, verification steps, and before/after comparison.
Linked Issues check ✅ Passed The PR fully addresses issue #4592 by implementing reactive revision resolution, the correct date precedence, and unit tests covering all cases as required.
Out of Scope Changes check ✅ Passed All changes are scoped to @agenta/entities (two files) and directly address the linked issue requirements; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 66.67% which is sufficient. The required threshold is 60.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deployment-last-modified-date

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/packages/agenta-entities/src/environment/state/appDeployments.ts (1)

126-131: 💤 Low value

Consider making variant lookup reactive in a follow-up.

The getDefaultStore().get(...) call bypasses Jotai's dependency tracking, so if the variants list updates, this value won't re-derive. This is acceptable for a legacy-data fallback, but for consistency with the now-reactive revision resolution, a future refactor could pass variants data similarly.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e9ff6a2-b5b7-498c-a6a6-0bbe0cb2c918

📥 Commits

Reviewing files that changed from the base of the PR and between eaf2d0c and bb6fd19.

📒 Files selected for processing (2)
  • web/packages/agenta-entities/src/environment/state/appDeployments.ts
  • web/packages/agenta-entities/tests/unit/app-deployments.test.ts

@mmabrouk
mmabrouk requested a review from ardaerzin June 9, 2026 12:03
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-06-10T13:52:13.588Z

@bekossy
bekossy changed the base branch from main to release/v0.103.1 June 10, 2026 13:51
@bekossy
bekossy merged commit 671d867 into release/v0.103.1 Jun 10, 2026
42 of 50 checks passed
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working Frontend lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants