Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
68c41ae
docs(#6407): adopt deterministic entity context staging
ifireball Sep 7, 2026
4238860
docs(#6407): specify stable entity context snapshots
ifireball Sep 8, 2026
2b2f615
docs(#6407): make conversation context cache-stable
ifireball Sep 8, 2026
c84c43b
docs(#6407): avoid duplicate conversation views
ifireball Sep 8, 2026
a623609
docs(adr): clarify entity context history and caching
ifireball Sep 9, 2026
f844301
docs(adr): separate entity and repository context
ifireball Sep 9, 2026
5e04855
docs(#6407): align entity context contract
ifireball Sep 9, 2026
9274bb0
docs(#6407): distinguish thread source keys
ifireball Sep 9, 2026
819d0ec
docs(#6407): tighten entity context canonical bytes
ifireball Sep 9, 2026
f82d5a0
docs(#6407): address entity context review feedback
ifireball Sep 14, 2026
78e782a
docs(#6407): remove staged source URLs
ifireball Sep 16, 2026
bf0405c
docs(#6407): harden staged context trust boundaries
ifireball Sep 16, 2026
f3b18a4
docs(#6407): address entity context review comments
ifireball Sep 16, 2026
b155f89
docs(#6407): close entity context review gaps
ifireball Sep 16, 2026
6762d74
fix(#6407): normalize pre-start check outcomes
ifireball Sep 17, 2026
2d829b7
docs(#6407): define entity schema bundle resolution
ifireball Sep 22, 2026
02c561f
docs(#6407): clarify entity-context v1 contract
ifireball Sep 23, 2026
be3215d
docs(#6407): include entity record header kind
ifireball Sep 23, 2026
3dbeedf
docs(#6407): harden entity-context contract
ifireball Sep 23, 2026
86fb1de
docs(#6407): qualify entity context snapshot name
ifireball Sep 23, 2026
7561cc6
docs(#6407): align GitHub structural ID rules
ifireball Sep 23, 2026
8e6d1af
docs(#6407): clarify snapshot ordering names
ifireball Sep 23, 2026
7f73bf3
docs(#6407): tighten snapshot source and trust rules
ifireball Sep 23, 2026
8f232f2
docs(#6407): represent bot actors explicitly
ifireball Sep 23, 2026
c723022
docs(#6407): align revision references across contracts
ifireball Sep 24, 2026
911f1f0
docs(#6407): keep bot roles unverified
ifireball Sep 24, 2026
5724b82
docs(#6407): make comment admission policy explicit
ifireball Sep 24, 2026
3bb7043
docs(#6407): separate role trust from event authorization
ifireball Sep 24, 2026
283fbe4
docs(#6407): account for filtered reviews
ifireball Sep 24, 2026
c6f7107
docs(#6407): align entity snapshot security boundary
ifireball Oct 14, 2026
f251019
docs(#6407): admit registered bot comments
ifireball Oct 14, 2026
bae8744
docs(#6407): close snapshot admission gaps
ifireball Oct 14, 2026
509d408
docs(#6407): make snapshot upload immutable
ifireball Oct 14, 2026
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
3 changes: 3 additions & 0 deletions docs/ADRs/0017-credential-isolation-for-sandboxed-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Date: 2026-04-01

Accepted (credential delivery tiers extended by [ADR 0025](0025-provider-credential-delivery-for-sandboxed-agents.md))

The default prefetch model is standardized for handled entity content by
[ADR 0141](0141-deterministic-filtered-entity-context-staging.md).

## Context

When sandboxed agents need to perform operations requiring credentials (e.g. reading or writing GitHub issues), the credential must be kept away from the agent process. A compromised agent with access to a credential can exfiltrate it — once the credential leaves the sandbox, the attacker can use it without any sandbox constraints.
Expand Down
5 changes: 5 additions & 0 deletions docs/ADRs/0076-slash-command-entity-context-separation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Accepted
Extends entity-context rules for conversation surfaces in
[ADR 0086](0086-conversation-surface-for-agent-participation.md).

Comment thread
ifireball marked this conversation as resolved.
Resolved
Terminology note: this ADR uses *entity context* for a dispatch-layer routing
category. [ADR 0141](0141-deterministic-filtered-entity-context-staging.md)
later names the distinct filtered data snapshot staged for a handled Git-forge
entity *entity-context-snapshot*.

Refines [ADR 0002](0002-initial-fullsend-design.md) (initial design) and
reinforces [ADR 0020](0020-composable-single-responsibility-agents-with-individual-sandboxes.md)
(single-responsibility agents).
Expand Down
177 changes: 177 additions & 0 deletions docs/ADRs/0141-deterministic-filtered-entity-context-staging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
title: "141. Deterministic filtered entity-context-snapshot staging"
status: Accepted
relates_to:
- agent-architecture
- security-threat-model
topics:
- entity-context-snapshot
- security
- harness
- token-cost
---

# 141. Deterministic filtered entity-context-snapshot staging

Date: 2026-09-07

## Status

Accepted

## Context

[Issue #6407](https://github.com/fullsend-ai/fullsend/issues/6407) identifies
that agents and harness scripts repeatedly fetch the issue or change proposal
they are handling, including comments, reviews, checks, and logs. Those
tool calls spend tokens, make runs depend on runtime network access, and give
Comment thread
ifireball marked this conversation as resolved.
Resolved
each consumer a different view when the entity changes during a run.

Forge content is also untrusted input. Fetching it directly from inside the
sandbox bypasses the deterministic point where Fullsend can bound, normalize,
redact, and label content before it reaches an agent. This decision generalizes
the preferred prefetch model from
[ADR 0017](0017-credential-isolation-for-sandboxed-agents.md) to every issue and
change-proposal run.

This ADR's *entity-context-snapshot* is the staged data snapshot. It is distinct
from the dispatch-layer routing category called entity context in
[ADR 0076](0076-slash-command-entity-context-separation.md). The qualified
name is intentional: it identifies the data structure without redefining ADR
0076's established routing term.

[ADR 0133](0133-actor-attributed-data-security-boundary.md) defines the
security boundary for actor-attributed source data: authorization is evaluated
for the actor of each current source revision, authorization permits data to be
considered but does not make its text safe, and every admitted record must pass
the common filtering, delimitation, and fail-closed rules. This ADR applies
that boundary to the deterministic snapshot path rather than defining a second
trust model.

## Decision

Before the harness pre-script, `fullsend run` uses `forge.Client` to assemble
one immutable snapshot of the handled entity. The runner applies a mandatory,
deterministic content pipeline to each complete selected source: Unicode safety
normalization, secret and sensitive-data redaction, injection scanning, then
size limits. A detector failure or timeout aborts snapshot assembly. It fails
closed when required data cannot be fetched or safely represented. Filtered
content is the only copy exposed to scripts and the agent; the manifest records
every truncation, replacement, finding, and fetch error without retaining
rejected content.

Record admission follows ADR 0133 and the role thresholds selected by the
agent's harness under [ADR 0054](0054-require-authorization-on-all-agent-dispatch-paths.md)
and [ADR 0098](0098-entity-first-harness-evaluation.md). Fullsend verifies the
source record's current-revision actor and current authorization independently
of the event sender, poller, retrieval credential, or discovery provenance.
Unauthorized, unattributed, or unverifiable comments and reviews are omitted
and represented by bounded manifest gaps; they are not exposed as raw or
filtered text. For a bot actor, Fullsend uses the provider-backed exact
`actor.bot_role` recognition defined by [ADR 0107](0107-bot-identity-resolution-for-dispatch-authorization.md);
the human repository-role threshold does not apply. A bot with no recognized
role, or with an unavailable or unverifiable lookup, remains omitted. Future
ADRs may broaden admission to additional provider-backed bot identities, but
this ADR does not invent a second bot-role mechanism. Successful authorization
is therefore an admission prerequisite, not a claim that the record is
trustworthy or can change platform authority.

The handled entity's body is actor-attributed content and follows the same
current-revision attribution and authorization rule. If its author is missing,
unverifiable, unauthorized, or fails filtering, Fullsend records an
entity-scope gap and aborts snapshot assembly; "required entity body" means
required only after successful admission and filtering.

The snapshot is written outside the repository clone. Host-side pre- and
post-scripts receive `FULLSEND_CONTEXT_DIR` pointing to an access-restricted
temporary directory outside the retained run-output tree; inside the sandbox
the same variable points to the runner-owned reserved sibling path
`/sandbox/entity-context-snapshot`. Fullsend must reject any checkout or `host_files`
destination that would overlap that path, and must abort if the reserved path
already exists with unexpected contents. Fullsend uploads that directory after
sandbox creation and before repository/runtime execution. Consumers therefore
use the same variable and relative paths on both sides of the sandbox boundary,
and the context cannot be staged or committed accidentally with repository
files.

The exact tree, schemas, canonical serialization, stable record-key derivation,
filter statuses, and compatibility rules are the versioned
[entity-context-snapshot v1 specification](../normative/entity-context-snapshot/v1/README.md).
Content records and mutable observation state are separate: resolving or
reordering a thread changes its state/index files, never an unchanged comment
or review body. No runner-clock timestamp enters the staged tree. Given the
same complete normalized acquisition inputs defined by the v1 specification—
including forge responses, authorization-provider results, effective admission
policy, collection profile, size bounds, filter version, and active
credential-redaction registry—implementations produce the same paths and bytes;
breaking that guarantee requires a new major specification.

The snapshot contains forge state that cannot be reconstructed from the target
Git checkout. It does not copy diffs, commit history, changed-file manifests,
or repository revision metadata. Fullsend provisions sufficient Git objects and
refs separately; controllers derive and filter diffs or commit projections for
agents and sub-agents that need them. Git object IDs appear in the
entity-context-snapshot to relate reviews, threads, comments, and agent runs to
repository state, and as the collected target revision in check metadata.

Each comment and review is a self-contained attributed record whose filename
sorts chronologically. The initial body uses the same record format and sorts
first. Order files define whole-conversation and review-focused projections and
refer to the same records rather than copying content. New replies append
without rewriting unchanged record files. Review-thread relationships, commit
references, and immutable Fullsend agent-run receipts preserve enough provenance
to relate a finding, the reviewed revision, a subsequent fix, and a re-review.

The pre-script may inspect the host snapshot and skip the run. At assembly time,
Fullsend retains the exact `index.json` bytes, or a digest of those bytes, in
host-private run state outside `FULLSEND_CONTEXT_DIR`. After the pre-script,
Fullsend compares the on-disk root index with that retained value and aborts on
any difference; it does not accept a rewritten index or re-parse it as the root
of trust. Only after that comparison does it verify child digests and the exact
manifest path set against the assembly-time index. Fullsend removes extra paths
or aborts assembly before upload. The sandbox copy is agent-immutable: it is
exposed through a read-only bind mount, or, where that is unavailable, a
root-owned tree with mode `0555` directories and `0444` files while the agent
runs unprivileged with `CAP_FOWNER` and equivalent write-overriding
capabilities removed. If neither mechanism can be enforced, Fullsend aborts
before launching the agent.

When a runtime injects staged context into a model request, it emits each
ordered record as a distinct content block, followed by relationship and
mutable-state blocks and then run-specific instructions. It must not collapse
the records into one changing prompt block when cache reuse is intended.
Provider prompt caching remains an optimization, not a conformance guarantee;
agents that read records through tools still pay the corresponding tool-result
tokens. Deterministic order projections remain navigation aids for selective
Comment thread
ifireball marked this conversation as resolved.
Resolved
reads. Runtime forge reads for entity-context-snapshot source kinds are denied by
default. An explicitly configured host-side extension may fetch a kind outside
the snapshot only when it applies the same versioned pipeline and fail-closed
rules and exposes no raw payload to the sandbox; it records the omission and
extension result outside the immutable v1 snapshot. A present extension
configuration that cannot be parsed denies every runtime entity-context-snapshot fetch.
Extension output uses the snapshot's `filter_version`, filter statuses
including `rejected`, and the same detector-failure abort rules. V1 extension
output outside the manifest is host-only and never sandbox-visible. Making an
extension result sandbox-visible requires a versioned schema that lists its
path in the manifest and subjects it to the same filtering, digest,
permissions, exact-path, and cleanup rules.

The host snapshot uses a mode-`0700` directory and mode-`0600` files. Those
host permissions do not make a sandbox copy read-only. Fullsend removes the
sandbox copy after its last sandbox consumer and the host copy after
the post-script, on success, failure, skip, or handled cancellation; startup
also scavenges orphaned context directories after abnormal termination. Context
is excluded from retained run artifacts by construction. Diagnostics may retain
only bounded counts, digests, and filtering findings, never bodies or logs.

## Consequences

- Agents start with one filtered, versioned view and avoid duplicate forge reads, but token and provider-cache savings are conditional on selective projections and segmented runtime injection rather than automatic consequences of staging files.
- Fullsend must provision the Git objects and refs required by each run, let controllers derive and filter repository projections on demand, and add segmented context input, cache-boundary support, and efficiency telemetry before claiming an improvement.
- Shipped and custom review, fix, and code agents must migrate from mutable sticky summaries and single-body hand-offs to discovered entity-context-snapshot projections, publish immutable per-run result receipts while retaining human-facing summaries, and anchor decisions to record keys and revisions.
- Forge adapters must expose review/reply relationships, locations, reviewed-revision references, checks, and immutable agent-result references through `forge.Client`; unavailable or unrecoverable forge history is an explicit manifest gap, not a silent omission.
- Snapshot assembly adds bounded startup latency and storage and can become stale, so collection profiles avoid indiscriminate log/history fetching and deterministic post-processing still validates relevant revisions before any forge mutation.
- The actor-attributed data boundary, including fresh authorization, common
filtering, redaction, delimitation, and fail-closed behavior, is inherited
from ADR 0133; future snapshot or retrieval paths must preserve that boundary
rather than treating this file layout as a security mechanism by itself.
12 changes: 12 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ repo baseline and overrides)
(contract: [`docs/normative/prescript-output/v1`](normative/prescript-output/v1/README.md)),
replacing the inline workflow pre-checks and their scaffold script copies
([ADR 0072](ADRs/0072-pre-script-output-protocol.md)).
- Deterministic forge entity-context-snapshot (v1): before the pre-script, the
runner fetches one
bounded entity snapshot through `forge.Client`, filters untrusted content,
and stages a versioned per-record file tree with relationship, projection,
and immutable agent-run lineage metadata outside the repository. Repository
diffs and commit history remain derived from the separately provisioned Git
checkout; the entity-context-snapshot carries Git object IDs only as
relationship anchors.
Scripts and the sandbox use `FULLSEND_CONTEXT_DIR` with the same relative
paths; runtimes may inject ordered records as separate cacheable input blocks
([ADR 0141](ADRs/0141-deterministic-filtered-entity-context-staging.md),
constrained by [ADR 0133](ADRs/0133-actor-attributed-data-security-boundary.md)).
- CEL-guarded overlays: an `overlays:` list of CEL-guarded config
overlays generalizes the `forge:` block, letting harness authors
condition scripts, skills, env vars, and other fields on any event
Expand Down
Loading
Loading