Skip to content

Dependency-aware agent operations

Prompt

Before responding to questions or discussion points in this document, explore the shakenfist codebase thoroughly. Read the cluster operation dependency machinery (depends_on / runs_after on BaseClusterOperation in shakenfist/operations/baseoperation.py, the dependency schema model in shakenfist/schema/operations/baseclusteroperation.py, and the dequeue-time evaluation, of which there are two near-identical copies, in shakenfist/daemons/queues/workitem.py and shakenfist/daemons/network/workitem.py), the agent operation object and its queue (shakenfist/operations/agentoperation.py, Instance.agent_operation_next in shakenfist/instance.py), the sidechannel dispatch loop (shakenfist/daemons/sidechannel/main.py), and the deadlines plan this plan is gated on (docs/plans/PLAN-agent-operation-deadlines.md), whose design this plan assumes has landed. The client-side surface lives in the sibling client-python repository, and the first example application in the sibling client-python-k3s repository. Ground your answers in what the code actually does rather than guessing.

All planning documents go into docs/plans/.

This plan began as a placeholder: intent, the decisions already made in discussion, and the known open questions, intentionally light on implementation detail, with phase 0 to resolve those questions into a decisions section and re-cut the phase table. Phase 0 has done both -- see "Decisions from phase 0" below, which replaces the open questions, and the re-cut table at the end -- so the sections above it are the record of how the plan was conceived and the sections below it are what will be built. Where the two disagree, phase 0's decisions win and say so. It could not begin until PLAN-agent-operation-deadlines had landed, because it builds directly on that plan's expiry semantics, terminal-only queue pop, and per-command capability registry. That plan is now complete (its nine phases all merged, the last of them 9bca46412), so the gate is clear and phase 0 is in progress.

When we get to detailed planning, I prefer a separate plan file per detailed phase, named for the master plan with -phase-NN-descriptive appended before the .md extension.

I prefer one commit per logical change, and at minimum one commit per phase. Do not batch unrelated changes into a single commit.

Situation

Agent operations execute linearly per instance with independent outcomes — ordering, not dependency; shell ;, not && (see the failure semantics section of PLAN-agent-operation-deadlines.md). Callers who need dependency semantics today either submit-and-await each operation serially, or rely on the intra-operation command list (which aborts remaining commands on error but is not composable from the public API).

Meanwhile cluster operations already carry a full dependency vocabulary, evaluated at dequeue in daemons/queues/workitem.py:

  • depends_on — fate-sharing. A missing dependency errors the dependent operation; a dependency in ERROR/DELETED/ABORT aborts it (the cascade); an in-flight dependency defers it, but not forever — once the defer budget is spent (DEPENDENCY_DEFER_BUDGET, 30 defers of exponential backoff and so roughly six minutes) abandon_dependency_wait() aborts the dependent operation, because a dependency which never goes terminal must not park one indefinitely (issue #3992).
  • runs_after — ordering only. Wait for the named operation to finish; its outcome is irrelevant; a missing operation is a logged warning, not fatal.

That is exactly the dependency-versus-ordering distinction agent operations lack, with the cascade following declared edges rather than queue adjacency — which is what makes it correct in a queue shared by unrelated callers. A fate-shared chain of depends_on edges is a transaction in every sense that is meaningful against a running operating system (rollback is not).

Separately: agent operations are a fairly unique idea and subtle to use well — this has become clear from how much design discussion the deadlines plan required. The documentation needs to be genuinely good, with worked examples, and the client-python-k3s plugin (which orchestrates k3s clusters over the sf-agent2 side channel, storing cluster state in namespace metadata) is already a de-facto example application. It should become the first of a curated suite of example applications that adopt each new agent operation feature as it lands, serving as both living documentation and functional exercise of the feature set.

Decisions already made

Settled in discussion (2026-08-14, the same thread that produced the deadlines plan) and not open questions:

  1. Extend depends_on / runs_after to agent operations rather than introducing a lane or session identifier or a new operation type. Dependencies are declared per-operation on the existing verbs; operations that declare nothing keep today's contract unchanged (linear order, independent outcomes). The cascade follows declared edges only.
  2. Cross-instance edges are in scope. Agent operation state lives in MariaDB and is cluster-visible, so an operation on instance A depending on an operation on instance B is a state read at dispatch evaluation, the same read workitem.py performs for cluster operations. This enables fire-and-await orchestration: a rolling update submitted as one dependency chain across a fleet, awaited as a unit by awaiting its final operation.
  3. Settle delays are an attribute on the dependency edge — "satisfied N seconds after the dependency completed" — not a sleep operation, which would hold an instance's executor slot to do nothing and require a healthy agent to run a no-op.
  4. Deadlines are the cycle-breaker. Amended by phase 0: there are no cycles to break. As written, this said that a dependency-blocked operation accrues queue time against its deadline (from PLAN-agent-operation-deadlines) so that user-created dependency cycles resolve by expiry rather than deadlocking. The premise is false. A depends_on edge can only name an operation which already exists: the API assigns every agent operation's UUID, a client cannot pre-declare one, an edge is static at creation and there is no API to add one later. Every edge therefore points backwards in creation order and the graph is a DAG by construction, which is also why decision 6 below does no graph walk.

The first clause still holds and is still useful — queue time does accrue against the deadline, so a blocked operation is not immortal — but it is not what makes this plan safe, and it is not a sufficient bound either, because a caller may ask for a deadline of a day (see decision 2 below). What the plan actually needs from PLAN-agent-operation-deadlines, and why that plan remains a hard prerequisite, is its queue-time expiry at dequeue, its terminal-only lazy queue pop, its node-local reaper, and the capability-token precedent which lets a new terminal state be introduced without hanging a released client's await. 5. Documentation with worked examples is a first-class deliverable, not an afterthought phase: a developer-guide treatment of the agent operation model (ordering, independence, deadlines, dependencies, retry) plus a curated example-application suite starting with client-python-k3s, updated as features land. Note that this is no longer greenfield: PLAN-agent-operation-deadlines phase 7 wrote docs/operator_guide/agent_operations.md (one executor per instance, the two budgets and where they are enforced, expired versus error, retry and the reaper, what to tune), and the API surface is in docs/developer_guide/api_reference/. What does not exist is a developer-guide page for the model itself.

Design sketch

Mechanically, the extension is: add depends_on / runs_after (and per-edge settle seconds) to AgentOperation static values and the creating API endpoints; admit ObjectType.AGENTOPERATION as a permitted dependency target; and evaluate edges at dispatch time in the sidechannel dispatcher, before an operation is handed to an executor.

Two notes on that sketch, from phase 0's survey of the tree. The permitted-types set is VALID_CLUSTER_OPERATIONS in the dependency schema, whose only consumer is the dependency model's own validator — so widening it is mechanically cheap, but it admits the edge in both directions and so answers open question 2 by accident, in favour of mixed-type edges, with no evaluator on the cluster side which can read agent operation state. The API parameter has a worked precedent rather than being novel: an array of structured objects is declared the way arrayofdiskspec and arrayofnetworkspec are (shakenfist/external_api/base.py:1038-1039), each nesting a schema which shakenfist/external_api/validation.py:641-660 compiles into a list of nested fields. The evaluation semantics mirror workitem.py: missing dependency errors, failed dependency cascades (abort/skip), in-flight dependency waits. The sidechannel has no defer machinery — a blocked operation simply stays queued and is re-evaluated on later dispatch passes, with the deadline bounding how long that can continue.

The awaited-transaction experience is the client's: submit the chain, await the final operation (which transitively awaits the rest), and report per-operation outcomes from the chain on failure.

Decisions from phase 0

Phase 0 resolved the seven open questions this section used to hold. Each decision below says which question it answers, and the reasoning is kept because the next reader of this plan is the person implementing it. The measurement and the consumer audit behind them are in the phase 0 plan.

  1. Strict FIFO is preserved: a dependency-blocked operation keeps its place in its instance's queue and blocks the operations behind it. Declaring a dependency does not opt an operation out of queue ordering. (Open question 1.)

Instance.agent_operation_next() is built on the head of the queue being the unit of recovery, and its crash-safety argument is that an instance has one executor; returning a dispatchable non-head candidate replaces that head pointer with per-operation claims, which PLAN-agent-operation-deadlines.md named as the reason concurrency is its own master plan. The alternative is also not merely "better utilisation": it gives the instance queue two contracts, so "put a file, then execute it" would hold only for operations which declared nothing.

The cost is that one caller's blocked chain stalls operations another caller submitted against the same instance. Whether that happens in practice could not be measured, and the plan records it as an assumption rather than a finding. Over the 22.5 days of sfcbr history Loki retains, half of all agent operations (913 of 1,804) arrived at an instance which already had an unfinished operation and the deepest queue reached eleven, so deep queues are real. But nothing records who submitted an operation: a request id is unique per operation, the API request log's identity field is null, and an operation's namespace is copied from its instance rather than from the caller, so "no cross-namespace overlap" is true by construction. Every deep queue observed was a burst of different commands on one instance, which is what a single client fanning out looks like and equally what several cooperating clients would look like. Treating "effectively one caller at a time per instance" as an operating assumption is therefore a choice, taken deliberately, and a reader who needs it to be a fact needs a submitter field on the operation first.

  1. The stall decision 1 accepts is bounded by a dedicated dependency-wait budget, defaulting to 300 seconds, and not by the caller's deadline. A blocked head whose wait exceeds the budget is aborted, in the manner of abandon_dependency_wait(). The budget is wall-clock from the first blocked evaluation, recorded as an operation attribute on first block, rather than a count of dispatcher passes. That attribute does not exist yet: phase 1 landed dependency_failure and nothing else, so phase 2 adds dependency_wait_started and the migration for it. The dispatcher's pass rate is throttled and variable where the cluster dispatchers' backoff is not, and one write beats one write per pass. It is a configuration option.

The deadline cannot be that bound. AGENT_OPERATION_DEFAULT_DEADLINE is 600 seconds but a caller may ask for AGENT_OPERATION_MAX_DEADLINE, 86400, so with deadlines as the only bound one caller could stall an instance's queue for a day by asking for a day.

300 seconds is chosen against measurement rather than by analogy. A dependency wait legitimately contains the dependency's own queue wait and its execution, which on sfcbr run to 39 seconds at p95 and 142 seconds at worst for a single hop, so the budget is about twice the worst single-hop latency that cluster has produced. A chain more than two hops deep on a busy instance could legitimately exceed it; that is documented rather than designed around, because the budget aborts an operation and does not corrupt anything.

  1. A failed depends_on moves the dependent operation to abort, a terminal state AgentOperation does not reach today. Not to error, which would claim the operation failed when its dependency did, and not to expired, which would claim a timing budget ran out. abort is the vocabulary the cluster-operation cascade already uses, and it is already in constants.FINAL_OBJECT_STATES, so an aborted operation is hard-delete swept where an errored one is not (issue #3922).

Introducing a terminal state is only safe because the dependency parameters are gated behind an API_CAPABILITIES token, the way deadline_seconds was: an operation can only reach abort if a client which declared a dependency created it, and such a client knows the state. That argument covers a client which polls the operations it created and not one which polls an instance's whole operation list, which phase 0's audit found client-python-k3s does. Its await_idle() treats an unrecognised state as still running by design and has no timeout, so one aborted operation would stall a released plugin on that instance until the hard-delete sweep cleared it an hour later. Teaching client-python-k3s the state, in its own pull request and release, is therefore a prerequisite of phase 1 rather than part of phase 5's adoption work.

Two obligations come with the state, both single-commit: abort must enter TERMINAL_STATES in the same commit that gives state_targets an edge to it, or agent_operation_next() takes its unknown-state branch and wedges the instance's queue permanently; and state_targets needs abort -> deleted, because delete() removes an operation's rows before assigning the state.

  1. Mixed-type edges between agent and cluster operations are out of scope, and the mechanism in decision 5 keeps them out by construction. (Open question 2.)

The use case is real — "run this script after the artifact fetch completes" — and is expressible today by awaiting the fetch client-side. Admitting it would mean evaluating edges in the two cluster-operation dispatchers as well, whose cascade helpers reach for defer(), current_defer_count and a schema model's target_fields, none of which an agent operation has. Recorded under Future work and filed as an issue.

  1. An agent operation's edges use their own model and their own permitted-target set, not the shared dependency model. Phase 0 found that widening VALID_CLUSTER_OPERATIONS, as the design sketch proposed, would admit the edge in both directions and so settle open question 2 by accident. Instead VALID_DEPENDENCY_OPERATIONS admits ObjectType.AGENTOPERATION for the agent edge model alone, the cluster validator keeps the set it has, and a cluster operation still cannot name an agent operation. The per-edge settle delay (decision 3 of the section above) is a field on the agent edge model for the same reason: on the shared model it would appear on every cluster-operation edge with nothing honouring it.

  2. Edges are validated at submission, and that is also the answer to cycles. (Open questions 3 and 5.) The API handler reads each named dependency once and refuses with a 400 if it does not exist, is not an agent operation, or belongs to a namespace the caller could not read. It does not walk the graph, because there is no cycle to find: see the amended decision 4 above. Namespace is checked at submission and never re-checked at evaluation — the edge was authorised when it was declared, and re-checking would let a later namespace change break a chain already in flight.

  3. Why an operation was cascade-aborted is on the wire. (Open question 4.) external_view() carries the failed dependency's type, UUID and state, in the manner of expiry_reason. The cause cannot ride on error_message, because the error setter refuses any state not ending in error, so without a field of its own the reason would live only on the state row and an instance audit event, neither of which a client sees. Issue #4075 is the precedent: a reason not on the wire is a defect, so this one is on the wire from the start.

  4. Edges are evaluated in the sidechannel dispatcher, between agent_operation_next() and start_instance_executor(). (Open question 6.) Not inside agent_operation_next(), which is the tempting precedent because the deadline check lives there, but which holds the agent_operations attribute lock across every read it makes. In the dispatcher a blocked operation simply stays queued, which is what the sidechannel's lack of defer machinery makes free, and a cascade abort is a state write the next pass's lazy pop retires. Evaluating after agent_operation_next() also means an expired head is expired rather than cascaded.

Cost control, because this loop's per-instance read cost is budgeted: an operation which declares no edges reads nothing; the reads hang off the existing per-instance throttle (DISPATCH_CHECK_INTERVAL, five seconds) rather than adding a cadence; a dependency observed in a terminal state is cached in process for the life of the dispatcher generation, since terminal is absorbing; and the reads are not budgeted, which phase 2's survey established and this sentence used to get wrong. The pair which grows is (GetObjectState, sidechannel), a member of HARNESS_DRIVEN_PAIRS in shakenfist/deploy/shakenfist_ci/load_budget.py with no entry in shakenfist/data/database_load_budget.yaml on purpose, because the model has no term for load which scales with in-flight operations. The (GetInstanceAttributes, sidechannel) entry this decision used to name covers agent_operation_next()'s instance attribute read and not a state read, so amending it would mis-attribute the cost. What phase 2 owes is a sentence in that exclusion's note naming the evaluator as a second producer. The dispatcher's supervisor replaces a thread which has not completed a pass in 120 seconds, which is the ceiling on how much work a pass may grow by.

One consequence to document rather than fix: the cascade is lazy, so a dependent which has not reached the head of its queue reads as queued through the API even after its dependency has failed.

  1. An evaluator reads a dependency's state by UUID and never hydrates the object. AgentOperation.delete() removes an operation's static and attribute rows before assigning deleted, so from_db() returns nothing for a user-deleted dependency and an evaluator which hydrated would misclassify it as missing. There is a related ambiguity with no clean answer, which the documentation must state: a dependency which completed, aborted, expired or was deleted is swept an hour after it finished, while an errored one never is, so a dependent which reaches the head long afterwards finds the dependency absent and cannot tell success from failure.

  2. Cross-instance edges cost nothing extra at evaluation and land with same-instance edges. The evaluator reads a dependency's state by UUID and never looks at which instance owns it; the only instance-aware work is decision 6's namespace check in the API handler. The phase which was to do them separately is folded into the evaluation phase below.

  3. The documentation deliverable is a developer-guide page plus an example index. (Open question 7.) The model treatment — ordering, independence, deadlines, dependencies, retry, with worked examples — goes to a new docs/developer_guide/agent_operations.md, because docs/operator_guide/agent_operations.md is a tuning and enforcement page for operators while the dependency vocabulary is an API contract. The example suite is an index section naming sibling repositories, with client-python-k3s first. Amended by phase 4: its rolling update was named here as the worked example, and there is no rolling update. Cluster.update_os() updates every node concurrently through execute_and_await(), and a fleet-wide chain would not fit the wait budget phase 2 shipped anyway, because a link's budget is anchored when that link is first found blocked rather than when its dependency finishes. The example suite survives; the example it was going to be does not, and choosing what replaces it is phase 5's first job. No new CI exercises the examples: each example repository has its own. The second example is chosen when there is a second feature to exercise, and is filed as an issue rather than invented here.

Non-goals

  • Rollback. Compensating actions against a running operating system are the caller's domain; the transaction concept here is ordering plus fate-sharing, nothing more.
  • Concurrent execution of independent agent operations on one instance. Dependency edges express ordering constraints; they do not change the one-executor-per-instance execution model. If parallel lanes are ever wanted, that is the separate re-engineering recorded in the deadlines plan's non-goals.
  • Agent-side cancellation of in-flight work (tracked from the deadlines plan; would sharpen cascade behaviour but is not required by it).

Phases

Re-cut twice. Phase 4's survey split this plan's documentation phase from its example-application phase, so documentation is phase 4, the client-python-k3s adoption is phase 5 and the push audit is phase 6; that row says why. The earlier re-cut was phase 0's, and what follows describes it. Two changes from the table it replaced: the cross-instance phase is folded into the evaluation phase, because decision 10 found that cross-instance edges cost nothing extra at evaluation, and the phases after it move up one. Phase 1 also carries a prerequisite which is not a phase of this plan: client-python-k3s must learn the abort state, in its own pull request and release, before this repository can emit one (decision 3).

Phase Plan Status Content Merged
0 PLAN-agent-operation-dependencies-phase-00-decisions.md Complete Resolve the open questions into the decisions section above, and re-cut this table. Its survey found five of this plan's factual claims wrong or incomplete; its measurement found that instance queues do get deep but that no log can say whether a deep one held two submitters; its consumer audit found one firm break outside this repository and one single-commit obligation inside it 4c14523a7b
1 PLAN-agent-operation-dependencies-phase-01-schema-and-api.md Complete Schema, object and API: depends_on and runs_after on AgentOperation with an additive table migration, the agent edge model and VALID_DEPENDENCY_OPERATIONS (decision 5), per-edge settle seconds, abort in state_targets and TERMINAL_STATES in one commit (decision 3), the parameters on the three creating endpoints with their declarations and capability token, and submission-time validation (decision 6). Prerequisite: client-python-k3s has learned abort and released -- met, by client-python-k3s#164 in v0.4.0. Its plan also lands the dependency_failure attribute column phase 2 writes, since this is the schema phase e6c0ba95a5
2 PLAN-agent-operation-dependencies-phase-02-dispatch-evaluation.md Complete Dispatch evaluation (decisions 1, 2, 8, 9, 10): same-instance and cross-instance edges evaluated in the dispatcher between agent_operation_next() and start_instance_executor(), the cascade to abort, the settle delay, the dependency-wait budget and its configuration option, the failed dependency on the wire in external_view(), and the terminal-dependency cache. Phase 1 landed the dependency_failure column this phase writes, but not the wait anchor decision 2 requires, so this phase still carries an attributes-table migration (version 5 to 6) -- its survey found that. Its survey also found that the database_load_budget.yaml amendment this row used to promise is not owed: the reads this phase adds are GetObjectState from the sidechannel, a pair deliberately excluded from the budget in load_budget.py, so only that exclusion's note is amended. Its contested decision lowers phase 1's published settle_seconds ceiling to the new wait budget, because any settle above the budget is unsatisfiable e5354766a4
3 PLAN-agent-operation-dependencies-phase-03-client.md (in shakenfist/client-python, on its develop) Complete client-python: chain pieces, await-the-chain UX, failure reporting from the chain's first failure, and abort in TERMINAL_AGENT_OPERATION_STATES. That frozenset must gain abort in the same commit as the submission parameters, or before them, never after -- the phase plan makes it a commit of its own, which is the same single-commit obligation phase 0 found between TERMINAL_STATES and state_targets. The plan file lives in the client repository because the code does, following the deadlines plan phase 6 precedent, and is linked absolutely because a relative link cannot cross repositories. Survey corrections applied at source, because this row was written during phase 2. (a) The await loop is at apiclient.py:1523 (the method begins at :1498), not :1443, and it does not hang forever: it is bounded by the caller's await_seconds or by _calculate_async_deadline() (-1, 60 or 3600 seconds by async strategy), so an unrecognised abort makes it poll to its deadline and then return the aborted operation with no exception, after which await_agent_command() raises AgentAwaitTimeout about an operation whose timeout was never the problem. A caller is misinformed rather than hung, and the ordering obligation is unchanged. (b) There is a second copy of the terminal-failure list with the same omission, and it is in this repository: base.BaseNamespacedTestCase.AGENT_OPERATION_FAILED_STATES at shakenfist/deploy/shakenfist_ci/base.py:1678, read by _await_command() and _await_agentop_complete(). The third copy, in client-python-k3s, already holds abort. (c) The functional test this row assigns to the phase cannot live in the client repository: the suite is shakenfist/deploy/shakenfist_ci/smoke_ci_tests/, and shakenfist/actions's setup-test-environment checks client-python out at its default branch for every run the client did not trigger, so the test fails here until the client half has merged. The phase is therefore two pull requests, client first, in the manner of the deadlines plan phase 6, and this Merged cell takes that phase's <repo> <sha> (#pr) form. The shakenfist half also carries finding (b)'s fix and this close-out. (d) The phase declines CLI --depends-on and --runs-after flags, because sf-client instance execute prints results and never the operation UUID, and exits 1 when an operation has no results yet, which is the state every queued dependent is in; filed as an issue rather than invented. Its contested decision is that the capability gate raises where the agentoperation-deadlines gate silently sends nothing, because a dropped ordering edge means "run now" where an omitted deadline only means "server default" -- and that a creating call verifies the edges it sent came back, since an older sf-database drops the fields and answers 200 shakenfist/client-python a2c9d0d1f4 (#453), shakenfist/shakenfist 6dde443468 (#4982)
4 PLAN-agent-operation-dependencies-phase-04-documentation.md Complete Documentation (decision 11): the new docs/developer_guide/agent_operations.md for the model, with worked examples and the example index, plus the release note this feature never got. Survey corrections applied at source, because this row was written by phase 0. (a) The dependency vocabulary is already in the API reference: docs/developer_guide/api_reference/instances.md:989 carries the parameters, the 400 refusals, the capability token, both edge lists' evaluation semantics, dependency_failure with its two non-state sentinels and an agentdependency section, and api_reference/agentoperations.md:7-14 carries the view field. Phases 1 and 2 wrote them, so nothing is owed. (b) The lazy-cascade and swept-dependency ambiguities are already written down, as two subsections of that same section, so this phase links to them rather than restating them. (c) Four pages already carry dependency facts -- those two plus the dependency-wait tuning at docs/operator_guide/agent_operations.md:255-285 and the column shapes at docs/operator_guide/database.md:1652-1680 -- which makes assigning each fact one home the design of the phase rather than a formality. (d) client-python-k3s adopting dependencies is moved to phase 5, for three independent reasons: the client surface phase 3 added is unreleased (v0.8.4 predates it and the plugin floors at shakenfist_client >= 0.7.7), so the work cannot begin; there is no rolling update to adopt edges in, since Cluster.update_os() updates every node concurrently through execute_and_await(); and a fleet-wide chain does not fit the budget this plan shipped. Its contested decision is to document that last point rather than change it: note_dependency_wait_started() anchors a link's wait when that link is first found blocked, which for a chain submitted up front is when it was submitted, so the whole chain must complete inside one AGENT_OPERATION_DEPENDENCY_WAIT and fleet-wide rolling work stays submit-await-submit fa6c8e1515
5 PLAN-agent-operation-dependencies-phase-05-adoption.md (in shakenfist/client-python-k3s, on its develop) Complete The first example application (decision 11 and "decisions already made" 5): client-python-k3s adopting dependency edges. Its plan file lives in that repository because its code does, following phase 3's precedent, and is linked absolutely because a relative link cannot cross repositories. The phase decides what to build, which the master plan left open, and the answer is fate sharing inside Cluster.execute_and_await(): each command submitted to an instance declares a depends_on edge on the previous command submitted to that same instance. Survey corrections to this row, applied at source. (a) The candidate is six call sites rather than the one this row named: instance_os_update() at cluster.py:3451 is the apt-get update/dist-upgrade pair, but the first control plane install (:3698), the node join (:3735), the metallb rollout (:3925), the metallb install (:3944) and the longhorn install (:3980) all pass strictly sequential multi-command lists too, so one change to one function reaches all six. Those line numbers are the ones in that repository's origin/develop; the phase's first survey read a clone sixteen commits behind it and every number in the phase plan was wrong, which also hid two extra call sites -- there are eleven, not nine, and the two new ones are single-command. (b) The reporting half is already built, by phase 1's prerequisite going further than it had to: AGENT_OP_FAILED_STATES at cluster.py:138 already contains abort, and exceptions.py:1275-1279 already explains an abort as a failed dependency. (c) The obvious implementation is wrong. execute_and_await() loops for cmd: for instance_uuid:, so chaining in aops order would declare a cross-instance edge on every multi-instance call, which spends the dependency wait budget a same-instance edge never starts and serialises a deliberately concurrent fan-out. (d) The release gates the live proof as well as the code: tools/ci_deploy_test.sh:293 installs shakenfist-client from PyPI, so the cluster-deploy tier runs the released client -- the mirror of phase 3's finding here, where CI takes client-python at its default branch. After the release that tier becomes the proof for free, since create() reaches three of the six sites. (e) sfcbr already advertises agentoperation-dependencies (checked 2026-11-26), so nothing waits on a server deploy. Its contested decision is that a cluster without the capability gets unchained submission and a written note, where phase 3 made client-python raise in the same situation: "run now" is not a regression for this plugin, it is what every released version does, and refusing to build a cluster at all because an optimisation is unavailable is the wrong answer to give a caller who asked for k3s and never mentioned dependencies. (f) The premise of this phase, and of this row, was wrong. A depends_on edge is satisfied by a dependency in complete, and a command which runs and exits non-zero leaves a complete operation: the sidechannel records the exit code as a result and sets no failure state (daemons/sidechannel/main.py:1005-1035), and the operation reaches STATE_COMPLETE once its commands have run whatever they exited with (:1684). Only DEPENDENCY_FAILED_STATES -- error, abort, expired, deleted, at :166 -- abandons a dependent (:2333-2351). So this row's worked example is not what the edge does: a failed apt-get update does not stop the dist-upgrade behind it, and reap_execute() reports it after the wait exactly as before. What the adoption delivers is abandoning the rest of a node's sequence when the operation before it never completed -- a wedged side channel, a fired deadline or progress timeout, a cascade -- which is the failure family this plan's parent was written for and is worth having, but is narrower than every statement of it so far. Found during execution by the phase's documentation step, and Michael's decision on 2026-11-27 was to land the phase with every claim corrected and to file the gap as a per-edge opt-in: #5091. Making a non-zero exit an error was declined, because commands which deliberately tolerate a non-zero exit, and every health probe, read a return code off a complete operation. That issue did not stay filed -- see (h). (g) The gate this row carried has cleared. The survey first read v0.8.4 (2026-10-28) as client-python's newest tag, from a clone three weeks stale; v0.8.5 is the release, it contains a2c9d0d1f4, and shakenfist-client 0.8.5 went to PyPI on 2026-11-25. So the phase is ready, and raising the plugin's shakenfist_client >= 0.7.7 floor to 0.8.5 is a step of the phase rather than something to wait for -- which matters because ci_deploy_test.sh installs the client from PyPI, so that floor is also what turns the cluster-deploy tier into the live proof. The phase is two pull requests, client-python-k3s first, the second here updating the example index phase 4 shipped. (h) The opt-in (f) filed was implemented hours later, outside this plan. #5099 (merge 1e4cad5665) closed #5091 through this repository's automated issue-fix workflow, on 2026-11-27, the day phase 5 merged. A depends_on edge now takes an optional require_success, satisfied only if every result the dependency recorded which reports a return code reports zero, and cascading the dependent to abort with a dependency_failure of nonzero-exit otherwise; it has its own capability token and is refused with a 400 on a runs_after edge. No phase of this plan owns it, which its own commit message says, so it is recorded here rather than claimed by one -- and phase 6 must decide whether its diff is in the audit. Nothing adopts it yet, because apiclient.agent_dependency() has no such keyword and the edge normaliser refuses any key outside op_uuid and settle_seconds, so the published client raises rather than sending it: filed as client-python#462. Michael's decision on 2026-11-28 was to record the field and not to build adoption of it, which is also what #462 makes the only option. The phase's own state: its client-python-k3s half merged as #177 (merge b233e21), unreleased -- v0.4.2 predates it -- and its live proof is unmet, because the merge-queue run which was the only run that could carry it failed Cluster deployment on under-cloud capacity (sufficient_idle_disk), which was triaged as systemic and merged on that triage. The first cluster-deploy run which passes on a develop containing b233e21 is the proof, and phase 6's survey found that it will not arrive on its own: that phase's execution note 10 says the tier "runs on every merge into this repository", which is wrong. The job is path-gated by Check paths, so #179 -- a documentation-only merge -- took merge-queue run 46123979721 to overall success with Cluster deployment skipped. The item is unmet until a pull request which touches code goes through that repository's merge queue shakenfist/client-python-k3s b233e21 (#177), shakenfist/shakenfist 09becc1186 (#5109)
6 PLAN-agent-operation-dependencies-phase-06-push-audit.md Complete Push audit. Survey corrections to this row, applied at source. (a) The diff this row asked for cannot be taken. It said "the accumulated diff of every phase in this plan against develop", but every phase is merged, so git diff develop...HEAD -- what every command in PUSH-AUDIT.md is written against -- is empty and each check would report success against nothing read. The row predates the rule it conflicts with: it was written on 2026-08-24 by fcffffb020, a bulk commit which gave the same sentence to several plans, and PUSH-AUDIT.md learned to read this column on 2026-09-13 in f445a9d31e, which forbids a union pass outright -- "a plan with four merges gets four passes, not one pass over a union that git cannot express". The baseline is therefore an explicit merge list, as the deadlines plan's phase 8 also found. (b) The footprint here is six merges, one per phase, and no phase landed an extra pull request in this repository -- unlike the deadlines plan, whose equivalent survey found nine merges for seven phases. Three of the six carry no Python at all (phases 0, 4 and 5), so the code waves have four ranges rather than six. (c) #5099 is in the baseline, which is the decision row (h) left to this phase. It is the only merge outside the phase branches in this plan's subject matter: every merge in the window was diffed against its first parent and grepped for the dependency vocabulary, and of thirteen non-phase matches ten are cluster operation dependency changes, which share the depends_on/runs_after vocabulary, while 2b551a5986 changed fail() -- a deadlines-plan method the cascade does not route through -- and a57e5b06b6 reflowed a comment about abort files. (d) Neither cross-repository half can be cited rather than read, which is what PUSH-AUDIT.md normally prescribes: client-python has no PUSH-AUDIT.md at all, so phase 3's half was never audited and could not have been, and phase 5 never ran the one client-python-k3s has. Both diffs are read against this repository's published contract, neither repository is edited, and findings become issues there. Findings land as their own pull request, and the plan is not complete until each is resolved or declined in writing here; if the audit finds nothing, that is recorded in one sentence -- and given (c)'s unreviewed range, a wholly clean result is itself worth a second look. (e) The audit was not clean, and its findings are resolved in the follow-up pull request this row's Merged cell does not name -- a pull request cannot record its own merge, which is why the audit's merge is what sits here and the plan reaches Complete with the findings fixed rather than with them filed. Three blocking findings and eleven advisory ones were fixed, four were declined in writing, and four became issues in the two client repositories. The blocking one vindicated decision 2: _dependency_succeeded() conflated an absent attribute row with a failed read, inside the #5099 range no phase of any plan owns, and the fix is the get_agent_operation_attributes_checked trio decision 2's objectors would never have had read. Two decisions of the follow-up are worth recording because they reverse what the audit proposed. Finding 6 was dispositioned "fix the published wording or the guard": the guard is right and the wording was fixed, because test_an_explicit_false_require_success_is_accepted_anywhere pins the lax behaviour deliberately -- an explicit false is what an omitted field already means, so an ordering edge sending one is not asking about an outcome. And finding 9's third item, the success cache's False path, is resolved structurally rather than by a test: the (readable, succeeded) pair became four OUTCOME_ verdict strings, all non-empty, so the falsy-cache hazard cannot be written any more and a mutant of if cached is not None: is confirmed to survive. Three of the four declines are in Future work; finding 19 is declined in the audit's own disposition table alone, per the escape clause in the table it was raised against 09dc95a6fb (#5127)

The Merged column records what put each phase on develop: the merge commit of its pull request, or an explicit first..last range where the phase landed directly. Phase 0 landed as pull request #4827, phase 1 as #4885 and phase 2 as #4909. Phase 3 landed as two pull requests, so its cell carries both in the <repo> <sha> (#pr) form: the client half first, because CI installs client-python at its default branch, and this repository's half once that had merged. Phase 4 landed as #5009, and that pull request also carried phase 3's close-out, which is why phase 3's cell was filled a phase after it merged. The remaining cells read — because those phases have not landed.

Phase 5 was registered as Blocked, on the reading that the plugin could not declare an edge until client-python published a release carrying phase 3's surface. That reading was wrong by a few hours: v0.8.5 carries it and reached PyPI on 2026-11-25, which the survey missed because the clone it read was three weeks stale. The row now reads Not started, and raising the plugin's floor to that release is the first thing the phase does rather than the thing it waits for.

Future work

Work this plan has deliberately declined or deferred, so that it is not lost:

  • Mixed-type dependency edges between agent operations and cluster operations, declined by decision 4 for the evaluation complexity rather than for want of a use case. Filed as #4824.
  • A second example application for the agent operation example suite, to be chosen when there is a second feature worth exercising. Filed as #4825.
  • A per-link dependency wait budget. Decision 4 of phase 4 documents the budget as it ships: a link's wait is anchored when the dispatcher first finds that link blocked, which across instances is when it was submitted, so a chain submitted up front must finish inside one budget. A budget anchored when a link's dependency finished would make fleet-wide chains work, but would leave unbounded the queue-head hold which decision 2 created the budget to bound. Phase 4 expected phase 5 to make the use case concrete. Phase 5's planning found it does not: its edges are all same-instance, and a same-instance edge never starts the budget at all. The first real adopter wanted fate sharing within a node rather than ordering across a fleet, which is a data point against the change rather than for it, so the question stays open and unassigned.

  • Adopting require_success. The per-edge opt-in which makes a depends_on edge notice a non-zero exit exists on the server, as phase 5's row (h) records, and nothing can declare it: the published client-python cannot send the key and raises on it (client-python#462), so neither client-python-k3s nor any other caller can opt in. The client gap is the work; adoption follows it, and is not assigned to a phase of this plan. Until then every statement this plan makes about what an edge catches -- error, abort, expired, deleted, and not a command which ran and failed -- remains the behaviour every caller gets.

  • Splitting the side channel daemon. shakenfist/daemons/sidechannel/main.py was 2,892 lines when phase 6's audit read it, from 2,266 before phase 2, and the dependency evaluator is already a drawn seam: its constants, three caches and six methods have one entry point and no coupling to the monitor or executor classes beyond three dictionaries. Phase 6's audit raised it and the follow-up declined it -- this repository has no size ratchet, and splitting a daemon is not an audit's work. Recorded rather than filed, because nothing is wrong today.

  • The edge lists fail open across an sf-api/sf-database version skew. A new sf-api against an older sf-database answers 200 and stores empty edge lists while still advertising the capability, so an operation the caller gated runs ungated. Phase 6's audit found it and the follow-up declined it as a defect: the failure is observable, because the echoed depends_on comes back empty and phase 3's client compares what it sent against what came back, and the remedy is the deploy order this repository already documents. It belongs in the operator guide's upgrade notes as a hazard rather than in the code as a check. require_success is not exposed to it, since #5099 added no proto field and rides inside the existing JSON.

  • Functional coverage for require_success. There is none and there can be none, because the field is unreachable from the published client -- the same client gap as the entry above this one. Phase 6's audit recorded that as the honest answer to "which functional test proves this field works", and the follow-up declined to invent one: a test which builds the request by hand would prove the server reads the key and nothing about the path a caller takes. It resolves when client-python#462 does, at which point the smoke tier can carry it.

  • A submitter identity on an agent operation. Decision 1 rests on an operating assumption which phase 0 could not measure, because nothing records who created an operation. A submitter field would make the question answerable and is not otherwise needed by this plan.

Bugs found during this work

  • agent_operations_queue in an instance's external view is always empty. Instance.external_view() reads the queued key of the agent_operations attribute, but every writer and every other reader uses queue, so the field is empty and the include-queued-agent-operations capability token advertises nothing. Found by phase 0's consumer audit, predates this plan, and filed as #4826 rather than fixed here. Fixed since, in pull request #4832 (merge 29b9a16226): the queue key now has a single reader, Instance.agent_operations_queued(), and the external view goes through it. Phase 1's survey confirmed it, which matters to this plan only because an instance's external view embeds each queued operation's whole external_view(), so a field added to an agent operation's view appears in the instance's too.

  • Nine sites still restate the namespace ownership predicate. Phase 1's review round two found that the ownership test (caller == object's namespace, or caller is system) is open-coded at eleven sites. Phase 1 introduced namespace_owns() and converted the two it touched; the other nine predate this plan and were filed as #4887 rather than swept here. Swept since, by 99f78d1ab8 ("Call namespace_owns() at every ownership site"), five commits after phase 1; #4887 is closed, and shakenfist/tests/test_namespace_ownership_predicate.py now fails the build if the literal predicate reappears. Phase 6's survey told a step this was still open, which it was not. docs/developer_guide/coding_rules.md rule 1 forbids restating a visibility predicate, and the issue records why the artifact access path must not be collapsed into the ownership one.

  • The cluster-side dependency walk carries both defects phase 2's first review round fixed on the agent side. The walk at shakenfist/daemons/queues/workitem.py:143-180 cancels a work item for a missing dependency when a from_db() read merely failed, and its depends_on walk falls through to satisfied for any state in neither of its two lists. The agent side answers the first with mariadb.get_state_checked() and a hold, and the second with a named satisfied arm plus a test derived from state_targets; neither transfers mechanically, because the cluster side hydrates its dependency rather than reading a state row, so the readability signal has to be designed rather than copied. Filed as #4910 rather than swept into phase 2, whose scope is confined to agent operations. Phase 5's push audit should not re-derive it.

📝 Report an issue with this page