Skip to content

feat: activity for hibernating, hibernated and waking workloads - #38

Merged
vitramir merged 2 commits into
mainfrom
claude/hibernation-activity-390e60
Oct 31, 2026
Merged

vitramir merged 2 commits into
mainfrom
claude/hibernation-activity-390e60

Conversation

@vitramir

Copy link
Copy Markdown
Contributor

Chat's activity_status and active_workload_ids learn the three hibernation statuses, as chat.md — Activity Status specifies them:

Most recent workload Contribution In active_workload_ids
waking pending yes
hibernating finished yes
hibernated finished yes

A hibernated workload stays in active_workload_ids because it is the one that moves next: the chat-app has to be in its workload:{id} room already to see the waking → running that follows the user's next message.

Until now the three statuses failed validateWorkloadStatus. A sleeping instance was logged as a Runners failure and shown as finished with its workload dropped from the list, and a waking one read the same. The running case and how agent_state is read are unchanged.

Safe to merge ahead of the rest of the rollout: nothing writes these statuses until a runner advertises hibernate, and the k8s-runner advertises nothing.

Also in this PR

  • Regenerated committed protos. CI generates only chat/v1 and threads/v1 and builds against the committed runners/v1, runner/v1 and identity/v1 bindings, which predated the new values. All six files were regenerated from buf.build/agynio/api main with the Dockerfile's path list, so they also carry what else landed there since (DeleteOrganizationResources, IDENTITY_TYPE_PLATFORM, the runner's HibernateWorkload/WakeWorkload, …) and protoc-gen-go v1.36.12, which builds against the pinned v1.36.11 runtime; go.mod is unchanged. buf dep update does not apply: the repository has no local protos, and it fails with "had no .proto files".
  • Threads fake stubs (first commit). threads.proto gained DeleteOrganizationResources, and since CI generates Threads from the module's main, the fakes no longer compile — on main as well. The stubs are Add DeleteOrganizationResources #37's, byte for byte and in the same place, so whichever of the two lands second merges cleanly.

Relation to #28

#28 restructures the running case and how agent_state is normalized; it has conflicted with main since #30 landed the same agent_state derivation. This PR touches neither: it adds waking to the pending case list, a finished case for hibernating/hibernated, and the three statuses to the status check and the ID filter. Checked by applying #28's server.go diff to both bases: the same three hunks reject on main and on this branch, and its fourth applies cleanly on both, so this PR adds no conflict to it.

Tests

  • One test per new row (TestGetChatsWakingWorkloadReturnsPending, TestGetChatsHibernatingWorkloadReturnsFinished, TestGetChatsHibernatedWorkloadReturnsFinished), each also checking the ID list, plus TestGetChatsActiveWorkloadIDsIncludeHibernationStatuses for the list across several participants (a stopped one left out, waking outranking the sleeping ones). All four fail against the previous derivation.
  • Local: gofmt -l and go vet ./... clean; CHAT_E2E_INPROCESS=1 go test ./... and go test -race ./internal/server green. CI's own steps (generate chat/v1 + threads/v1 only, go test without e2e, go build) green on a clean export of the branch. The repository has no linter config; staticcheck was not run (the local binary is built with Go 1.25 and cannot load the 1.26 toolchain).

Not in this PR

The spec splits failed on the instance's state (active → pending, paused → finished). Chat reads no instance state and maps every failed to pending. That predates hibernation and is left as it is.

threads.proto gained DeleteOrganizationResources, and CI generates the
Threads bindings from the module's main on every run, so the fakes no
longer satisfy ThreadsServiceClient and internal/server stops compiling
its tests. A CI run on main today fails the same way.

The stubs are #37's, byte for byte and in the same place, so whichever
of the two lands second merges without a conflict.
A workload can now sleep between turns and come back on the same
record: running -> hibernating -> hibernated, then hibernated ->
waking -> running on the next message. Chat rejected the three
statuses as unsupported, so an instance whose workload slept was
logged as a Runners failure and shown as finished, with its workload
dropped from active_workload_ids -- and a waking one read the same,
where the chat should show the agent coming back.

waking now contributes pending. hibernating and hibernated contribute
finished: the agent is asleep between turns, and the next message
wakes it. All three are listed in active_workload_ids, a hibernated
workload because it is the one that moves next -- the chat-app has to
be in its room already to see the waking -> running that follows the
user's message. The running case and how agent_state is read are
unchanged.

The committed protos were regenerated from buf.build/agynio/api main:
they predated the three statuses. They pick up what else landed there
since, and protoc-gen-go v1.36.12, which builds against the pinned
v1.36.11 runtime.

See agynio/architecture: changes/2026-10-27-workload-hibernation.md
@vitramir
vitramir merged commit 463ddc9 into main Oct 31, 2026
1 check passed
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