Skip to content

feat: add on-demand residency foundation - #490

Open
schickling-assistant wants to merge 2 commits into
mainfrom
schickling-assistant/2026-09-06-auto-suspend-prototype
Open

feat: add on-demand residency foundation#490
schickling-assistant wants to merge 2 commits into
mainfrom
schickling-assistant/2026-09-06-auto-suspend-prototype

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Problem

Agent desired state currently implies continuous process residency. There is no durable model for an agent that remains desired but can be cold between work bursts.

Goal

Add the typed foundation for on-demand residency without changing host orchestration yet.

Decisions

  • Keep desired state (running | suspended | retired) separate from residency policy (always | on-demand).
  • Model runtime residency as a durable tagged state machine.
  • Key the canonical ledger by host, immutable agent ID, and generation.
  • Keep the delivery ledger as the only message-delivery authority.
  • Fail closed on ambiguous inventory or transition evidence.

Verification

  • Agent Spec discovery and KDL round-trip tests cover residency on-demand.
  • Residency unit tests cover legal transitions, stale generations, stop ordering, and persistence.
  • Task inventory tests cover policy and runtime-residency wire shapes.
  • cargo check --workspace passes on the complete stack.

Complexity

The large addition is the explicit ledger and transition model. Later PRs consume this model instead of duplicating provider-specific lifecycle state.

Concerns

This PR intentionally does not suspend or wake processes. Host policy arrives in PR #494.

Friction & bottlenecks

None specific to this layer.

Follow-ups

References

Part of stack #495.

Posted on behalf of @schickling
field value
agent_identity mbp2025.direct.omp.bn5hrz39
session mbp2025.bn5hrz39
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.1.7
agent_runtime OMP 18.1.7
tooling_profile dotfiles@4816a7a

@schickling-assistant schickling-assistant changed the title schickling assistant/2026 09 06 auto suspend prototype feat: add on-demand residency foundation Sep 6, 2026
@schickling-assistant
schickling-assistant force-pushed the schickling-assistant/2026-09-06-auto-suspend-prototype branch from 19d73e4 to af17328 Compare September 9, 2026 16:13
agent-identity: mbp2025.direct.omp.bn5hrz39
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.1.7
agent-runtime: OMP 18.1.7
tooling-profile: dotfiles@4816a7a
@schickling-assistant
schickling-assistant force-pushed the schickling-assistant/2026-09-06-auto-suspend-prototype branch from af17328 to 7b3055e Compare September 9, 2026 16:49
@schickling-assistant
schickling-assistant marked this pull request as ready for review September 10, 2026 08:50
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

@codex review

Posted on behalf of @schickling
field value
agent_identity mbp2025.direct.omp.bn5hrz39
session mbp2025.bn5hrz39
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.1.7
agent_runtime OMP 18.1.7
tooling_profile dotfiles@4816a7a

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b3055ed29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/residency.rs
Comment on lines +183 to +186
match self.runtime_residency {
RuntimeResidency::Quiescing { resume }
| RuntimeResidency::Stopping { resume, .. }
| RuntimeResidency::Cold { resume } => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject cold ledgers whose wake is already pending

When a restored ledger contains state: "cold" with wakePending: true, this validation accepts it, but apply(WakeDemandObserved) returns Duplicate before entering Starting, while next_action() is also None. The agent therefore remains cold indefinitely despite durable demand. Reject this impossible state combination during validation so malformed persisted evidence fails closed rather than silently suppressing every wake.

Useful? React with 👍 / 👎.

Comment thread src/task_inventory.rs Outdated
Comment on lines +455 to +458
let runtime_residency = spec.effective_session_driver().and_then(|driver| {
let path = crate::residency::ledger_path(catalog, host, &agent_id);
match crate::residency::load(&path, &agent_id, host, driver) {
Ok(Some(ledger)) => Some(ledger.inventory_projection()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fence residency reads across runtime observation

When the supervisor advances this ledger while RuntimeObserver::observe is running, the row can combine the residency value loaded here with a later process observation—for example, runtimeResidency: "cold" with a newly running process, or "active" with an already stopped one—and still report complete=true. The checks in tasks_cmd reread declarations and the catalog fence, neither of which changes for a residency-ledger update, so the normal transition race is not detected; reread and compare the ledger after process observation, marking the inventory incomplete if it changed.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T08:54:44.368032Z 7b3055e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

agent-identity: mbp2025.direct.omp.bn5hrz39
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.1.7
agent-runtime: OMP 18.1.7
tooling-profile: dotfiles@4816a7a
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