feat: add on-demand residency foundation - #490
Conversation
19d73e4 to
af17328
Compare
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
af17328 to
7b3055e
Compare
|
@codex review Posted on behalf of @schickling
|
There was a problem hiding this comment.
💡 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".
| match self.runtime_residency { | ||
| RuntimeResidency::Quiescing { resume } | ||
| | RuntimeResidency::Stopping { resume, .. } | ||
| | RuntimeResidency::Cold { resume } => { |
There was a problem hiding this comment.
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 👍 / 👎.
| 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()), |
There was a problem hiding this comment.
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 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
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
running | suspended | retired) separate from residency policy (always | on-demand).Verification
residency on-demand.cargo check --workspacepasses 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
agent_identitysessionagent_personaagent_supervisoragent_toolagent_tool_versionagent_runtimetooling_profile