feat(ateapi): record last_resume_time on actors - #950
Open
NekoPunch (orangeCatDeveloper) wants to merge 1 commit into
Open
feat(ateapi): record last_resume_time on actors#950NekoPunch (orangeCatDeveloper) wants to merge 1 commit into
NekoPunch (orangeCatDeveloper) wants to merge 1 commit into
Conversation
Timestamps the RUNNING transition, one of agent-substrate#277's two remaining fields (create_time and update_time already live on ResourceMetadata). total_running_duration stays out: it is a cross-replica subtraction that clock skew can drive negative into a monotonic counter, and the crash cut-off semantics are undefined. Rollout: ateredis unmarshals with strict protojson, so roll all ateapi replicas forward together and clear lastResumeTime from stored actors before any rollback. Claude-Session: https://claude.ai/code/session_01XuQqkwLf5Zx6CSZFHSC6hb
NekoPunch (orangeCatDeveloper)
force-pushed
the
issue-277-last-resume-time
branch
from
August 15, 2026 09:20
10be0fd to
ed4bc0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #277
Actors carry no record of when they last started running, so there is no way to
answer "how long has this actor been up" from the API.
What this adds
A
last_resume_timetimestamp onActor, stamped at the single place an actortransitions into RUNNING:
It is not cleared on suspend or pause — the field answers "when did it last come
up", and stays queryable while the actor is down.
Scope
#277 lists four fields.
create_timeandupdate_timealready exist onResourceMetadata, leaving two; this coverslast_resume_time.total_running_durationis deliberately left out. Unlike an absolute timestampwritten by one replica, a cumulative duration is a subtraction across replicas —
resume stamps on replica A, suspend computes
now(B) - last_resume_time(A)—so clock skew can produce a negative delta that accumulates permanently into a
field documented as never resetting. It also needs accounting at all six exits
from RUNNING (crash, syncer crash, suspending, pausing, pause-failure crash,
deleting), and the cut-off for an actor killed without a clean transition is
undefined. Those are design questions, not implementation detail.
Rollout: ateredis unmarshals with strict protojson, so roll all ateapi replicas
forward together, and clear
lastResumeTimefrom stored actors before anyrollback.
Tests
TestFinalizeRunning_SetsLastResumeTimecovers the stamp.TestEnsureSuspendedFinalized_KeepsLastResumeTimepins the preservationbehaviour — it fails with
LastResumeTime = 1970-01-01 ..., want 2026-01-01 ...if the suspend path drops the field.