Repository navigation
docs(#6407): adopt deterministic entity context staging #7080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ifireball
merged 33 commits into
fullsend-ai:main
from
ifireball:codex/adr-entity-context-staging
Oct 14, 2026
Merged
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 4238860
docs(#6407): specify stable entity context snapshots
ifireball 2b2f615
docs(#6407): make conversation context cache-stable
ifireball c84c43b
docs(#6407): avoid duplicate conversation views
ifireball a623609
docs(adr): clarify entity context history and caching
ifireball f844301
docs(adr): separate entity and repository context
ifireball 5e04855
docs(#6407): align entity context contract
ifireball 9274bb0
docs(#6407): distinguish thread source keys
ifireball 819d0ec
docs(#6407): tighten entity context canonical bytes
ifireball f82d5a0
docs(#6407): address entity context review feedback
ifireball 78e782a
docs(#6407): remove staged source URLs
ifireball bf0405c
docs(#6407): harden staged context trust boundaries
ifireball f3b18a4
docs(#6407): address entity context review comments
ifireball b155f89
docs(#6407): close entity context review gaps
ifireball 6762d74
fix(#6407): normalize pre-start check outcomes
ifireball 2d829b7
docs(#6407): define entity schema bundle resolution
ifireball 02c561f
docs(#6407): clarify entity-context v1 contract
ifireball be3215d
docs(#6407): include entity record header kind
ifireball 3dbeedf
docs(#6407): harden entity-context contract
ifireball 86fb1de
docs(#6407): qualify entity context snapshot name
ifireball 7561cc6
docs(#6407): align GitHub structural ID rules
ifireball 8e6d1af
docs(#6407): clarify snapshot ordering names
ifireball 7f73bf3
docs(#6407): tighten snapshot source and trust rules
ifireball 8f232f2
docs(#6407): represent bot actors explicitly
ifireball c723022
docs(#6407): align revision references across contracts
ifireball 911f1f0
docs(#6407): keep bot roles unverified
ifireball 5724b82
docs(#6407): make comment admission policy explicit
ifireball 3bb7043
docs(#6407): separate role trust from event authorization
ifireball 283fbe4
docs(#6407): account for filtered reviews
ifireball c6f7107
docs(#6407): align entity snapshot security boundary
ifireball f251019
docs(#6407): admit registered bot comments
ifireball bae8744
docs(#6407): close snapshot admission gaps
ifireball 509d408
docs(#6407): make snapshot upload immutable
ifireball File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
docs/ADRs/0141-deterministic-filtered-entity-context-staging.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
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 | ||
|
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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.