Skip to content

P1 Core Envelope: add durable Core-bound mutation sessions and sink admission #135

Description

@James3014

Parent / dependency

Parent umbrella: James3014/Nexus-new#957.

Depends on the stable public contract produced by James3014/nexus-core#28.

Current source fence at child creation:

main@e6f8a218c5a71efd02e15603d2bed9e98e1e0374

DevSpace remains execution/control transport only. This Issue must not create route, Planner, Workforce, verifier, Completion, Candidate-acceptance, merge, release or deployment authority.

Problem

DevSpace already has reusable mutation-control primitives:

  • workspace/worktree identity;
  • durable agent/process/session identity;
  • expected-HEAD and foreign-mutation checks;
  • capability-discovery pre-mutation gate for write-capable agent_start;
  • durable continuation/reconciliation;
  • typed Git/Candidate operations.

But current mutation sinks are not Core-bound. A write-capable agent or direct DevSpace mutation can act without one immutable AcceptanceContract binding, and shell/PTY/raw processes retain OS filesystem authority.

Target design

Use one immutable durable Core-bound mutation session per logical bounded mutation attempt, then require all supported mutation sinks to validate that same binding immediately before effect.

Do not create one Core contract per sink and do not create a second workspace/session authority.

Session binding

Consume the frozen nexus.repository_mutation_binding.v1 projection from Nexus-new#957. Persist at minimum:

  • binding id/hash;
  • exact repository/origin identity;
  • exact source commit/tree;
  • workspace identity/mode;
  • execution lane + existing authority reference/hash as opaque metadata;
  • capability-discovery identity when required;
  • canonical Core AcceptanceContract + hash;
  • operation id / attempt id;
  • freshness/rebind state.

DevSpace validates/carries this projection but does not decide lane/route or mint Core truth.

Commitment point

For write-capable paths, binding must be valid after lane/capability/authority resolution and before the first write-capable process/tool receives mutation authority.

Read-only operations stay usable without fake Completion subjects.

Supported sink families

Inventory current source again at implementation time, then cover every supported sink in these families where present:

  • direct structured file write/edit/apply operations;
  • agent_start / delegated worker start;
  • agent_continue / resume;
  • managed Codex goal start/continue where mutation-capable;
  • exec_command/shell/PTY and write_stdin lifecycle;
  • Git commit / publication preparation;
  • Candidate formation/integration preparation.

Do not claim a sink is covered because only agent_start was gated.

Structured writes vs unrestricted processes

Structured write sinks may claim pre-write machine enforcement only when the actual effect is bounded by the sink and binding.

For unrestricted shell/PTY/raw processes, unless a proven filesystem sandbox already exists:

CORE_BOUND_SESSION_REQUIRED
PATH_LEVEL_PREWRITE_CONTAINMENT_NOT_PROVEN

Do not expand this Issue into a new OS sandbox project. Physical changed paths are still checked post-effect and scope escape blocks trusted completion.

Continuation / replay / reconcile

  • same logical operation reuses the same immutable binding;
  • continue/resume/write_stdin requires the exact original valid binding;
  • changed/broadened binding after possible effect => conflict;
  • base drift before first effect => rebind required / block;
  • timeout/unknown outcome => reconcile same operation, never create a new binding or blind resend;
  • provider/model/session identity is execution attestation only, not Core authority.

Physical ChangeSet export

After mutation, expose enough physical state for the consumer/Nexus layer to construct the Core subject:

  • source commit/tree;
  • target commit when one exists, otherwise deterministic target Git tree;
  • actual changed/deleted paths;
  • canonical change-manifest inputs / object identities;
  • operation/attempt/workspace/binding provenance.

Do not trust worker prose as physical ChangeSet truth.

Acceptance criteria

  • Write-capable supported start without a required valid Core binding fails before mutation authority.
  • Read-only start remains available without fake AcceptanceContract/ChangeSet.
  • Exact binding is durably persisted with workspace/session/operation identity.
  • agent_continue/resume rejects missing, changed, stale or broadened binding.
  • Worker cannot widen allowed paths, required verifier IDs or deletion policy by returning a broader contract.
  • Existing capability-discovery gate is reused/composed rather than replaced by a parallel authority.
  • Structured direct writes check the same session binding before effect.
  • Managed Git/Candidate publication carries Core binding provenance.
  • Shell/PTY is labeled honestly and cannot claim path-level containment without an actual sandbox.
  • Physical reconciliation can produce the exact post-effect subject/provenance needed by Core verification.
  • Timeout/restart does not create retry permission or a second logical mutation attempt silently.
  • Existing session/conversation collision and capability-generation protections remain intact.

Negative controls

  • missing contract -> supported write blocked;
  • forged contract hash -> blocked;
  • stale base -> blocked/rebind;
  • same session continued with changed binding -> conflict;
  • worker adds a path/verifier/deletion permission -> rejected;
  • admitted shell writes outside contract and still reports machine-contained -> FAIL;
  • historical unbound session is continued as Core-bound -> FAIL;
  • uncertain process outcome starts replacement attempt instead of reconcile -> FAIL;
  • provider/model identity is treated as lane/Core authority -> FAIL.

Non-goals

  • implementing Core canonical hashing/verification itself;
  • choosing DIRECT_CANONICAL, DIRECT_DELEGATED, or GOVERNED;
  • model routing/admission;
  • general filesystem sandbox;
  • Candidate acceptance / merge / deploy.

Claim ceiling

Completion may claim only:

DEVSPACE_CORE_BOUND_MUTATION_SESSION_SOURCE_VERIFIED

No claim that Nexus-new completion gates or resident Open SWE are live until their own consumers are integrated and canaried.

Stop boundary

Implement and test in DevSpace only after the Core public protocol dependency is stable. Produce a bounded Candidate/PR; do not auto-modify Nexus-new or Open SWE.

AUTO_CHAIN=false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions