Skip to content

Compose Git acquisition grants, shutdown and retained-source recovery - #227

Merged
HemSoft merged 12 commits into
mainfrom
feature/issue-176-acquisition-boundary
Oct 21, 2026
Merged

HemSoft merged 12 commits into
mainfrom
feature/issue-176-acquisition-boundary

Conversation

@HemSoft

@HemSoft HemSoft commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Compose the private Git acquisition factory from the pinned runtime, credential generation, fixed grants, original process/mount/descriptor observations and bounded plain export archive. Source escapes only after broker/acquisition join, independent physical-stop proof, credential-generation acceptance and retained run disposal. Unknown outcomes retain ownership.

PollOptions.Source holds capture and restored-job evidence until consumers release them. Retention preserves pending captures, active consumers, retained SQLite jobs and uncertain workers. Eligible terminal attempts retire through fsynced intents and atomic directory moves, with startup completing interrupted cleanup. Idle polls collect expired source; polls skip the factory retention lock while a capture is active. Work roots must have different opened identities from both journal roots.

Restore keeps the exact admitted packet and original unit/archive binding across release, helper and worker upgrades. The parent authenticates older unit receipts against their existing cached worker bytes; retirement uses that same original-image check. Missing or changed old bytes refuse, and old receipts cannot launch through the new image.

Related to #174 and #176. The lifecycle prerequisite #226 merged at 57f4cb6; this PR targets main. These broader issues remain open.

Acceptance Criteria

  • Bind the fixed manifest/assets/release/snapshot to each fresh attempt. Check readiness before allocating its nonce or slot, and reject aliased roots before ownership transfers.
  • Authenticate original peers/pidfds and verify unit, namespaces, maps, mounts, devices, workspace bounds and exactly eight inherited descriptors before work grants.
  • Join/revoke acquisition work, independently prove physical stop and obtain generation acceptance before source publication. Retain uncertain owners for explicit recovery.
  • Restore exact packet, coverage and anchors after restart and worker/release upgrades without host Git, refetch or labels. Durable terminal receipts survive manager/cgroup collection.
  • Release consumers on admission, fencing, errors and completion. Closing refuses active consumers. An expired lease alone does not permit source removal.
  • Reuse the 128 active-record bound through crash-safe terminal retirement, with canonical intents, original object/hash checks and foreign replacement refusal. Active capture does not create a polling retention timeout.

Definition of Done

  • Twelve owned commits and 27 owned files are disjoint from both parent layers; only owned commits were replayed onto the corrected parent.
  • Meaningful offline, real storage/process and inert namespace tests pass, with their limits recorded below.
  • Vet and the fresh full opt-in race suite pass on the published source.
  • Required current-head review, zero unresolved threads and guarded merge.

Validation

Head b157c18e43c332c32d1d58f93a84ef28595a8337, parent 57f4cb6d1f1151f23b0edc90726e020d3341d204.

  • go -C reviewer vet ./...: pass.
  • SFL_GIT_DESCRIPTOR_KERNEL=1 SFL_GIT_BOOTSTRAP_NAMESPACE=1 go -C reviewer test -race ./... -count=1: pass, main package 174.072 seconds. This run and vet executed at 2b2acc1; the current whole repository tree is identical after replaying only the twelve owned commits onto the actual parent squash. Tree 5ed9749299b1321fb5ba96399b73cf8581c9038f matches exactly; no test rerun or new code change is claimed.
  • Focused source/retirement/polling suite: pass, 5.739 seconds. Red regressions reproduce healthy-capture retention backoff, acceptance of both journal aliases, old-worker startup rejection and old-worker retirement rejection. The alias fixture uses short real roots and checks the path bound, so unrelated length validation cannot mask the defect.
  • The upgrade case changes release/hash, helper manifest and worker binary, removes the original old worker path and synthetic Git quarantine, restores identical source, preserves expired unknown leases and independent active/pending consumers, then retires expired unreferenced source. No signing or network recapture occurs.
  • Retirement covers 140 stopped attempts, six modeled deletion boundaries, foreign replacement/cancellation and an actual owner SIGKILL after its durable directory move. A contender proves the old lock was held before new owners resume. Deletion is limited to known original objects.
  • Actual nonancestor inspection uses a non-root inspector with zero host permitted/effective/ambient capabilities, worker dumpability zero, ancestry through PID 1 and verified user-namespace owner/parent chain. Original root, executable, mappings, mounts and pidfd descriptor inspection pass. Additional host file/directory/Internet/inheritable/eventfd/epoll handles refuse.

Manager/cgroup observations and credential transports are fake. Pipes, pidfds, flock, sealed files, fsync, process kills and trusted Git fixtures are real. The namespace worker is an ordinary measured inert executable, not qualified sealed production execution. Synthetic upgraded worker bytes and the existing root-owned helper test asset are never executed.

Risks and deferred work

The fixed noswap systemd path still fails on mini with 226/NAMESPACE; sealed inner-worker execution fails with EACCES. The actual noexec filesystem fixture remains skipped. Inert subset passes do not waive these gates.

Unit/archive roots must share a filesystem. At most 128 active exports retain about 4 GiB plus framing; recovery scans at most 128 intents and two fixed trash directories per intent. Small work directories remain recovery artifacts, and old worker copies remain until dependent records retire. Uncaptured active/exited manager metadata can remain after proof of original physical termination; coordinated manager cleanup belongs to complete host/resource qualification. No later source cleanup stops a unit name.

Trusted service/release/startup wiring, provider/account/subscription/public-target/auth and billing evidence, native controls and comparative evaluation, release promotion/rollback, final rendered GitHub evidence and explicit owner live authorization remain separate work. No credentials, App configuration, live inference, paid use, deployment, host policy or retired automation are activated.

Copilot AI lite review requested due to automatic review settings October 21, 2026 15:30
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Four unresolved moderate findings cover descriptor exactness, intake cleanup, resource cleanup, and valid path handling.

No open issues 🎉

What changed in this PR

This PR composes a private Linux Git acquisition factory with credential lifecycle management, containment checks, broker shutdown, archive recovery, and blob-based source restoration.

Changes:

  • Adds mount, descriptor, ancestry, grant, and unit validation.
  • Coordinates capture, restore, shutdown, credential release, and recovery.
  • Expands lifecycle, recovery, boundary tests, and documentation.

Open findings:

  • Exact inherited eventfd/epoll descriptors are not enforced.
  • Failed acquisitions can leave receiving archive records.
  • Constructor failures may leak transferred resources.
  • Valid deployment paths can be rejected by the directory-length check.
File Reviewed change
reviewer/​snapshot_evidence.go Shared packet and anchor reconstruction
reviewer/​GIT-MOUNT-BOUNDARY.md Mount qualification documentation
reviewer/​GIT-FACTORY.md Factory lifecycle documentation
reviewer/​GIT-EXPORT-ARCHIVE.md Archive recovery documentation
reviewer/​GIT-DESCRIPTOR-BOUNDARY.md Descriptor qualification documentation
reviewer/​git_unit_grant_linux.go Grant asset and binding validation
reviewer/​git_source_factory_linux.go Source factory composition and lifecycle
reviewer/​git_source_factory_linux_test.go Factory startup and restoration tests
reviewer/​git_mount_boundary_linux.go Mount observation and validation
reviewer/​git_mount_boundary_linux_test.go Mount policy and fixture tests
reviewer/​git_factory_unit_linux.go Unit and ancestry checks
reviewer/​git_factory_unit_linux_test.go Unit validation tests
reviewer/​git_factory_run_linux.go Acquisition, grants, broker, and shutdown
reviewer/​git_factory_run_linux_test.go Run lifecycle and failure tests
reviewer/​git_factory_recovery_linux.go Startup and intake recovery
reviewer/​git_factory_recovery_linux_test.go Recovery behavior tests
reviewer/​git_factory_evidence_linux.go Materialization evidence reconstruction
reviewer/​git_factory_acquisition_linux.go Credential-bound acquisition orchestration
reviewer/​git_factory_acquisition_linux_test.go Publication and lease-ordering tests
reviewer/​git_export_archive_linux.go Discarded-intake and terminal close handling
reviewer/​git_descriptor_boundary_linux.go Inherited descriptor observation and validation
reviewer/​git_descriptor_boundary_linux_test.go Descriptor policy and observation tests

Review effort: Lite

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T20:02:15.447291Z b157c18 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6cbec3ff0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread reviewer/git_factory_recovery_linux.go Resolved
Comment thread reviewer/git_source_factory_linux.go Resolved
@HemSoft

HemSoft commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Addressed all four passive review concerns in 820ff68.

  • Descriptor admission now requires the exact eight-handle inventory, including one eventfd and one epoll. Actual inherited extra eventfd/epoll fixtures failed before the fix and now refuse; the clean measured worker still passes.
  • A known stopped failed capture retires incomplete intake in the current process only after credential-generation acceptance. An unaccepted lease cannot retire it. Unknown or corrupt outcomes fence Capture/Restore until explicit Recover drains the retained local work.
  • Ownership transfers only after all local handles are retained. A later startup failure returns a complete nonnil owner alongside the error for explicit Recover/Close. Tests prove unknown startup retains its real flock/runtime, refuses new work and recovers only after independent terminal evidence. Basic validation failures leave inputs with the caller.
  • Path validation checks the actual bootstrap/worker/broker Unix socket paths. A valid longer root failed before the fix and now works; exact 107-byte paths pass and overflow refuses.

Vet and the fresh full race suite pass on the corrected source, main package 159.907 seconds, with both actual namespace/descriptor opt-ins. Manager/cgroup and credential transports remain fake; the fixed systemd noswap tmpfs and sealed-inner-worker physical gates are still failed. Required current-head review remains a merge gate.

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6cbec3ff0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread reviewer/git_source_factory_linux.go Resolved
Comment thread reviewer/git_factory_run_linux.go Resolved
Comment thread reviewer/git_factory_recovery_linux.go Resolved
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-boundary branch from 820ff68 to 7383bc6 Compare October 21, 2026 17:31
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 822440917e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread reviewer/git_factory_run_linux.go Resolved
Comment thread reviewer/git_source_factory_linux.go Resolved
Comment thread reviewer/polling.go Resolved
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-factory branch from 7dfe596 to 9123249 Compare October 21, 2026 17:59
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-boundary branch from 8224409 to b8bf7ea Compare October 21, 2026 18:06
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-factory branch from 9123249 to 5af8476 Compare October 21, 2026 18:17
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-boundary branch from b8bf7ea to 44e31ab Compare October 21, 2026 18:17
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e31ab86d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread reviewer/polling.go Resolved
Comment thread reviewer/git_source_factory_linux.go Resolved
Comment thread reviewer/git_factory_recovery_linux.go Resolved
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-boundary branch from 44e31ab to 2b2acc1 Compare October 21, 2026 18:48
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@HemSoft
HemSoft changed the base branch from feature/issue-176-acquisition-factory to main October 21, 2026 18:51
@HemSoft
HemSoft force-pushed the feature/issue-176-acquisition-boundary branch from 2b2acc1 to b157c18 Compare October 21, 2026 18:52
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: b157c18e43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@HemSoft
HemSoft merged commit 83d54be into main Oct 21, 2026
@HemSoft
HemSoft deleted the feature/issue-176-acquisition-boundary branch October 21, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants