Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: "165. Recover work through repository-owned operation journals"
status: Accepted
relates_to:
- durable-work-recovery
- agent-architecture
- agent-infrastructure
topics:
- coordination
- recovery
---

# 165. Recover work through repository-owned operation journals

Date: 2026-11-10

## Status

Accepted

## Context

Per-subject serialization ([ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md))
and occurrence-aware poll state
([ADR 0132](0132-occurrence-aware-shared-poller-state.md)) reduce duplicate
dispatch. They do not reserve an operation across scheduling, worker failure
and external publication. Runtime workflow packaging in
[#8225](https://github.com/fullsend-ai/fullsend/pull/8225) addresses another
boundary: delivering a sequence to an agent runtime.

[Durable work recovery](../problems/durable-work-recovery.md) describes the
failure cases. This ADR aims to keep admitted work recoverable across hosts
without making a model or a central daemon the coordination authority.

## Options

Integration-owned databases offer flexibility but repeat the same recovery
controls. A mandatory workflow service adds an operated dependency. A
repository-owned journal reuses forge state and existing schedulers, at the
cost of conditional writes and explicit reconciliation.

## Decision

Fullsend adopts repository-owned operation journals to recover work across
dispatch, execution and publication.

The trusted host records work before dispatch in repository-scoped forge
storage with integrity checks and compare-and-swap updates. An admitted plan
defines stable operation identities, required children and persistent work
bounds. Attempts retain their own identity, source/input revisions and
scheduler/run identifiers. Scheduling acceptance, worker completion and each
publication effect have separate receipts. Loss of an acknowledgement leaves
recoverable pending work rather than advancing a completion checkpoint.

Short-lived reconcilers use leases and monotonically increasing ownership
generations. Every result acceptance, state transition and publication
admission checks the current generation and plan. A timed-out or superseded
worker cannot authorize a new effect. A publication admitted before ownership
loss remains an in-flight effect to reconcile; expiry cannot revoke a request
already accepted by an external service. Remote writes remain in trusted host
adapters, outside worker sandboxes.

Publication adapters persist intent before writing, use a stable external
operation marker, and reconcile ambiguous outcomes before retrying. An
eventually consistent search returning no match is not proof a create failed.
If the adapter cannot establish the outcome, it holds publication for operator
resolution. It can retry publication from retained validated evidence without
rerunning inference, subject to current authorization, source and policy.
Missing, exhausted or unresolved required children remain visible and cannot
imply completion. A configured domain adapter may request investigation after
failure, but cannot turn that request into a successful worker assessment.

This is a deterministic host capability. It adds neither a coordinator agent
nor authority from journal contents. Existing actor, entity, disclosure and
repository gates still apply. Domain mapping, assessment semantics and ticket
rendering remain adapters. Journal records contain bounded identities, digests
and receipts, not raw private prompts or credentials. Artifact publication
policy still applies. Journal integrity failure stops scheduling and
publication; it does not silently reset state and repeat work.

## Forge scope

The contract applies to GitHub, GitLab and Forgejo target repositories.
Each backend must demonstrate conditional updates and the same recovery
tests before enablement. Initial implementation may enable GitHub alone;
GitLab and Forgejo remain disabled until their adapters conform. Jira may be
a source or publication destination; its unconditional issue-property writes
do not satisfy the journal's compare-and-swap requirement.

## Consequences

- Recovery can resume scheduling or publication without keeping a host or
model session alive.
- Existing forge storage and CI schedules remain the coordination substrate.
- Backend integrity, ownership and ambiguous-write tests become enablement
gates; delivery is not claimed to be exactly once.
- Adopters must define target identity and completion rules while Fullsend
enforces the shared recovery boundary.
- Journal layout, credentials, retention and adapter implementation require
follow-up work before this capability is available.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: "166. Select Pi extension tools without widening access"
status: Accepted
relates_to:
- security-threat-model
- agent-architecture
topics:
- runtime
- tools
- security
---

# 166. Select Pi extension tools without widening access

Date: 2026-11-10

## Status

Accepted

## Context

[ADR 0094](0094-pi-extensions-are-harness-resources.md) admits extension code
through trusted harness resources. The Pi runner translates built-in agent
tool names, but drops other declared names. An extension can therefore load
while its tool cannot be selected by a strict agent allowlist.
Comment on lines +24 to +26

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. Adr does not link the pi tool-dropping behavior it describes 📜 Skill insight ⚙ Maintainability

The Context section of ADR 0166 states as current behavior that the Pi runner drops declared
extension tool names, so an extension can load while its tool cannot be selected. The paragraph
links ADR 0094 and #9179, but neither introduces the translation behavior: ADR 0094 covers extension
admission and #9179 covers MCP patterns. A reader cannot trace when or why the dropping behavior was
introduced, and the PR description's pinned-commit evidence does not substitute for that provenance
link in the ADR itself.
Agent Prompt
Issue description
ADR 0166 Context states that the Pi runner drops declared extension tool names, but it links only ADR 0094 and #9179, neither of which introduces that translation behavior. Current-behavior descriptions need a link to the PR, issue or ADR that introduced them.

Fix Focus Areas
- docs/ADRs/0166-select-pi-extension-tools-without-widening-access.md[23-29]

Recommended Fix
Identify the PR, issue or ADR that introduced `piToolsFor` dropping unmapped exact tool names, and add that link to the Context paragraph next to the current-behavior sentence. If no such record exists, state that explicitly in the ADR so the provenance gap is visible.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

[#9179](https://github.com/fullsend-ai/fullsend/pull/9179) addresses MCP tool
patterns and child permissions; ordinary extension tools need the same
least-privilege property without acquiring an MCP identity.

The [threat model](../problems/security-threat-model.md) requires tool access
to remain bounded. This ADR aims to let an agent select an exact tool supplied
by a vetted Pi extension without enabling unrelated tools.

## Options

Removing the strict tool list exposes default tools and unrelated extension
tools. Hardcoding every plugin's name into the built-in translation table
couples independently versioned resources to runner releases. Resolving exact
declared names against the loaded extension registry preserves that boundary.

## Decision

Fullsend resolves exact declared Pi extension tool names against vetted
extensions to preserve strict tool selection.

Keep existing built-in translations. Treat an otherwise unmapped exact name
as a requested native extension tool, and resolve it only after loading the
runner-vetted extension set. A missing or ambiguous requested tool fails the
run before inference. It never falls back to all extension tools, Pi defaults
or a broader built-in tool. This decision does not add wildcard matching for
native extension tools or change MCP pattern semantics.

The effective tool set is explicit, including when empty. Hook authorization
uses the same canonical native name. Child runs, if supported, load the vetted
code that supplies a requested tool and receive only the intersection of
parent and child permissions. A runtime path that cannot enforce this refuses
the selection. Repository discovery cannot supply tools or alter identity;
extension integrity checks continue before launch and retry. Selecting a tool
does not grant shell, filesystem, network or publication authority.

## Forge scope

This runtime contract applies equally to GitHub, GitLab and Forgejo runs.
It introduces no forge-specific provider or authorization exception.

## Consequences

- A read-only agent can expose one extension tool while excluding builtin
shell, editing and compatibility tools.
- Tool typos and missing extensions become explicit setup failures.
- Hook checks and child permission tests must use the same resolved names.
- Runner implementation and real-Pi denial tests are required before native
extension selections are supported.
13 changes: 12 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ flowchart TB
([ADR 0158](ADRs/0158-overlays-may-grant-runtime-fetch-within-the-config-allowlist.md)).
Decided, not yet implemented.
- Plugins are runtime-scoped harness resources: a harness declares `plugins:` as one list of directories in its own repository (same trust and fetch path as skills), and each entry's format decides which runtime loads it — a `plugin.json` bundle is Claude Code's, a directory pi's `-e` loader resolves is uploaded and loaded after a tree-hash preflight computed from the host copy. Each runtime names and skips the entries in the other format, so the list survives a runtime switch. Because `--no-extensions` plus explicit `-e` closes the set of code that can register tools, no per-tool declaration is needed ([ADR 0094](ADRs/0094-pi-extensions-are-harness-resources.md)).
- Decided, not yet implemented: exact Pi extension tool selections resolve
against runner-vetted extensions and keep an explicit effective tool set,
including empty sets; unsupported selections fail before inference
([ADR 0166](ADRs/0166-select-pi-extension-tools-without-widening-access.md)).
- Decided, not yet implemented: extend the runner-owned native Codex child
policy to V2 alongside the 0.166.0 bump. Bootstrap requires the `Agent` tool,
harness security and a direct-route parent selecting V1 or V2 in the bundled
Expand Down Expand Up @@ -618,6 +622,12 @@ The existing design principle is that [the repo is the coordinator](problems/age
[#8418](https://github.com/fullsend-ai/fullsend/issues/8418) and
[#8421](https://github.com/fullsend-ai/fullsend/issues/8421).

- Decided, not yet implemented: repository-owned operation journals retain
separate dispatch, execution and publication receipts. Conditional state
updates and ownership generations support cross-host recovery while domain
adapters retain target and completion semantics
([ADR 0165](ADRs/0165-recover-work-through-repository-owned-operation-journals.md)).

**Open questions:**

- What provider query plans can support entity-first evaluation over the
Expand All @@ -632,7 +642,8 @@ The existing design principle is that [the repo is the coordinator](problems/age
- Is GitHub's event system sufficient for forge-native duplicate protection, or
do we need additional coordination beyond label/state conventions and agent
idempotency? (Jira polling per ADR 0063 uses entity-property locks and runner
lock refresh; ADR 0098 does not resolve this question.)
lock refresh; ADR 0165 chooses an operation journal for recoverable effects,
while adapter implementation and external-system guarantees remain open.)
- How does work assignment interact with the backlog/priority agent described in [agent-architecture.md](problems/agent-architecture.md)?
- How should explicit cancellation, retry, and reassignment interact with the
automatic event-coalescing policy in
Expand Down
10 changes: 10 additions & 0 deletions docs/problems/agent-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ This principle aligns with what Yegge's Gas City project calls "Zero Framework C

[OpenAI Symphony](../landscape.md#openai-symphony) is the other useful contrast: a long-running central daemon that owns scheduling state, candidate selection, and retry. Where Gas City puts a controller on the path but forbids it from containing judgment, Symphony's orchestrator visibly contains it (priority sort, blocker rules, reconciliation). Fullsend can borrow Symphony's workspace safety invariants and continuation-turn semantics without adopting the daemon.

Cross-host scheduling and partial external writes need deterministic recovery
without adding a coordinator agent; see
[durable work recovery](durable-work-recovery.md).
[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md)
chooses repository-owned operation journals; implementation remains open.

### How agents communicate

Agents interact through GitHub's existing mechanisms:
Expand Down Expand Up @@ -227,6 +233,10 @@ The multi-agent framework space is expanding rapidly, with new entries appearing

**Observable delegation, still a single coordinator ([Kiro Crew](../landscape.md#kiro-crew)).** Kiro Crew lets a parent conversation delegate to sub-agents that "return their results to the parent conversation," with every step — planning, sub-agent spawning, tool selection, approvals — observable live via the Agent Client Protocol. The observability is worth borrowing: making agent reasoning and tool calls inspectable in real time, rather than only after the fact in a transcript, is a good default regardless of coordination model. But the coordination model itself is the same star topology as MetaGPT and CrewAI — the parent conversation is the coordinator, and it consumes a sub-agent's returned result without the zero-trust composition fullsend's independent review sub-agents apply to each other's findings. It is a session-scoped pattern (one developer's crew, running on their own machine or a remote host they control) rather than a repo-scoped one, so it does not need to answer the question this document is built around: what authorizes a decision when no single human or agent is watching.

Exact Pi extension tool permissions are decided in
[ADR 0166](../ADRs/0166-select-pi-extension-tools-without-widening-access.md);
the runtime must enforce them without widening access to default tools.

## Open questions

- Should agents be stateless (fresh context per task) or stateful (accumulated knowledge of the codebase)? Stateless is safer (no poisoned state persists) but less efficient.
Expand Down
6 changes: 6 additions & 0 deletions docs/problems/agent-infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ Many fullsend scenarios skew toward **ephemeral, task-scoped** execution (triage
- **Governance** — Policy may be applied at runtime by agents reading from a policy repo; infrastructure determines where that runtime runs and how it accesses policy.
- **Repo readiness** — Repos need reliable CI and signals; agent infrastructure may consume or depend on the same CI (e.g. for “run tests” or “run linters”) and should not conflict with it. Headless runtimes amplify **feedback latency** and **workspace handoff** costs when CI is the only execution path.

Restarting workers also needs durable ownership and reconciliation of external
effects; see [durable work recovery](durable-work-recovery.md).
[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md)
chooses repository-owned journals and short-lived reconcilers; backend
implementation and operational acceptance remain open.

## Open questions

- What is the right level of isolation per agent (process, container, microVM, separate cluster)?
Expand Down
5 changes: 5 additions & 0 deletions docs/problems/cross-run-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ These splits suggest that "memory" may not be one feature. It may be several fee

Cross-run memory is one piece of a broader question: what happens when an agent fails? The memory problem asks how agents learn from prior failures. The recovery problem asks what the system does immediately after a failure, before any learning occurs.

Recovering scheduling ownership and ambiguous external writes is a separate
mechanical problem; see [durable work recovery](durable-work-recovery.md).
Its operation journal retains attempts and work bounds without deciding
whether another model approach is likely to succeed.
Comment on lines +89 to +92

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Living-doc edits reach documents outside the adr's problem areas 📜 Skill insight ≡ Correctness

The PR adds durable-work-recovery backlink paragraphs to docs/problems/cross-run-memory.md and
docs/problems/operational-observability.md, but neither file is in ADR 0165's relates_to list
(durable-work-recovery, agent-architecture, agent-infrastructure). The rule asks that
living-document changes stay within the ADR's problem areas, and these two additions are cross-links
to the new durable-work-recovery doc rather than edits to a relates_to area. A reviewer reading ADR
0165 alone would not expect these two files to change, so the decision's scope becomes harder to
audit.
Agent Prompt
## Issue description
The PR edits `docs/problems/cross-run-memory.md` and `docs/problems/operational-observability.md` alongside ADR 0165, but neither document is in the ADR's `relates_to` list, so the living-document changes exceed the ADR's declared problem areas.

## Fix Focus Areas
- docs/problems/cross-run-memory.md[89-92]
- docs/problems/operational-observability.md[50-53]
- docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md[1-10]

## Recommended Fix
Either add `cross-run-memory` and `operational-observability` to ADR 0165's `relates_to` if the cross-links are intended, or remove those two backlink paragraphs from this PR and keep the ADR's living-document edits to `architecture.md`, `agent-architecture.md` and `agent-infrastructure.md`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


### Retry vs. escalate

When a run fails (CI failure, merge conflict, model refusal, timeout), the system must decide: retry the same approach, try a different approach, or escalate to a human. Execution limits bound how much work can occur, but reaching a limit does not establish whether another attempt is likely to produce a different outcome.
Expand Down
88 changes: 88 additions & 0 deletions docs/problems/durable-work-recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
title: Durable work recovery
---

# Durable work recovery

A job can disappear after discovery, finish after its caller stops, or publish
an external change before its acknowledgement is saved. A successful model
invocation does not answer whether the requested work was scheduled, which
attempt owns it, or whether publication must be retried.

The [repository coordination model](agent-architecture.md#interaction-model-the-repo-as-coordinator)
keeps authority in repository-visible controls. Recovery must preserve that
boundary. It needs deterministic bookkeeping, rather than an agent deciding
which other agents should run. The
[infrastructure discussion](agent-infrastructure.md) also separates execution
capacity from waiting for people or external systems.

## Failure boundaries

- A dispatcher stops after a remote scheduler accepts a request but before it
records the scheduler's run identifier.
- Two hosts discover the same operation while neither has reserved it.
- A worker's lease expires; its replacement starts while the old worker is
still running.
- A worker saves valid evidence, but its publication request times out after
the external system creates the issue or comment.
- One required child never returns while other children succeed.
- Source, authorization or a target plan changes while work is queued.

Serialization for a harness and subject reduces overlap. It does not make
dispatch, execution and external writes one transaction. A source checkpoint
or the absence of a running CI job cannot prove completion. Operators need to
distinguish these conditions from ordinary agent failures; see
[operational observability](operational-observability.md#what-just-happened).

Persistent attempt bounds supply recovery mechanics, while
[cross-run escalation](cross-run-memory.md#error-recovery-and-retry-mechanics)
also needs failure interpretation and policy. A journal does not decide whether
a different model strategy is likely to succeed.

## Options and trade-offs

### Let each integration own its recovery

An adapter can maintain a database and reconcile its own jobs and external
effects. This is flexible and avoids a new platform contract. Each adapter
must also implement authorization rechecks, duplicate prevention, restart
handling and publication recovery. Guarantees can differ across workflows.

### Extend repository-owned state

A repository-scoped journal can use conditional forge writes and short-lived
reconcilers. Existing schedulers still run individual workers. This fits the
repository coordination model and avoids a required central service. It needs
explicit trust, retention, conflict, lease and external-effect protocols;
eventual-consistency searches cannot establish that an ambiguous write failed.

### Delegate to a durable workflow service

A service can supply timers, retries and ownership. It introduces another
operated component and trust boundary. Its scheduler guarantees still do not
make a remote issue creation atomic or authorize a retry after scope changes.

## Decision and acceptance

[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md)
chooses a repository-owned journal. Its implementation remains separate from
the decision. A local database test is not distributed acceptance.

Fault tests must stop both sides of each handoff, overlap reconcilers, expire
ownership while a worker is still alive, and supersede a plan before
publication. A remote write that succeeded before its acknowledgement was
lost must be reconciled without rerunning inference or blindly repeating the
write. Every required target remains accounted for, including exhausted or
missing attempts. A domain adapter may publish an investigation request when
analysis fails; that request is not an assessment or permission to remediate.

## Open questions

- Which journal layout, signing rules, retention and compaction bounds meet
the conditional-write and integrity requirements on each forge?
- Which existing scheduler APIs can reconcile accepted-but-unacknowledged
requests by stable operation identity?
- Which publication adapters can safely prove a write absent, and which must
retain an ambiguous operation for human reconciliation?
- How should an operator repair corrupted or inaccessible state without
discarding accepted work or permitting stale workers to publish?
Loading
Loading