SAP-3151: Create writable idempotent project subsessions - #808
Conversation
Refs: SAP-3151
Refs: SAP-3151
Refs: SAP-3151
Refs: SAP-3151
Refs: SAP-3151
Refs: SAP-3151 # Conflicts: # packages/harness/src/server/agent-map-mcp-tools.ts
Refs: SAP-3151
Review — PR #808 (SAP-3151, writable idempotent project subsessions)Public-copy hygiene: clean. The changeset, 1. Recursive delegation has no depth or live-session cap
Failure: a project agent that decomposes three levels deep — a normal reading of "delegate 2. Request receipts never expire — delegation dead-ends permanently at 8,192
Failure: 3.
|
Refs: SAP-3151
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Refs: SAP-3151
|
/review |
Follow-up review — PR #808 (delta since
|
Primary change type
Problem and motivation
Project agents need a role-neutral way to delegate focused work to ordinary writable sessions without creating duplicate sessions, processes, kickoff turns, or tabs on retry. Recovery also needs to remain strictly scoped to coordinator-owned sessions so manual user sessions are never adopted or mutated.
Summary and scope
project_subsession_delegatecontracts with capability-derived project, user, and parent-session scope, canonical request digests, exact optional assignment/map-node/brief focus, and deterministic real-session results.subsessions.jsonaggregate.release-dormantrecovery for exited/failed coordinator bindings in its project, regardless of parent liveness. It accepts no session IDs, atomically rechecks and closes each selected child before private cleanup, preserves ordinary session history, and never selects active or manual sessions.request_key_expired/new_request_key, while a fresh request key may create exactly one new binding, session, and process for the same delegation key.releasedoutcome truthfully even when exact private SessionManager cleanup must be retried.recovery: "release_dormant"; a genuinely all-active live cap remainsinspect_sessionand never suggests dormant cleanup.This PR does not add consent, approvals, planner/builder roles, read-only execution modes, special map-mounted tabs, repository/deployed-agent orchestration, or SAP-3152 cutover work.
Related work
Related issue or discussion: SAP-3151 — Create writable idempotent project subsessions
Stacked on #807 /
conductor/sap-3150-role-neutral-focused-briefsatacb2dbae6a3e533e01a065c43fa4109bdd82ca14.Validation
Tests and documentation
Added contract/codec, durable-store, SessionManager, coordinator, Codex rollout broker, MCP/wiring, adapter behavior, telemetry, and browser navigation tests. Release coverage proves exact ownership, manual-session protection, identity-free mixed unknown keys, idempotent retry, exited/failed release, real PTY closure, bounded sidecar/tombstone retention, restart recovery after cleanup failure, dormant-vs-active capacity accounting, atomically rechecked active-child exclusion, retained ordinary session history, and project/manual-session safety. The active-parent eviction regression proves a sibling can sweep a dormant child, emits exactly one content-free release event, expires the original request with bounded
request_key_expired/new_request_keyrecovery, and lets a fresh request create one different real session/process under the same delegation key. A cleanup-failure regression proves that a durable dormant eviction remains truthfullyreleasedwith bounded inspection guidance while the exact private marker is retained for idempotent retry, then pruned successfully on replay without another release event. Error-contract coverage proves durable-history capacity namesrelease_dormantwhile a live cap retainsinspect_session. Spawn coverage also proves two coordinator instances racing an expired self-owned claim create exactly one child process. Updated the shared build-plan guide, public tool schema, changeset, and common project-agent prompt to document writable nested delegation, recovery, focus, destructive dormant release, retention, and manual-session protection.Compatibility and release impact
SubsessionCoordinator; transcript-backed session hosts must complete exact runtime identity correlation before trusted background kickoff. This is a minor change while@sapiom/harnessis pre-1.0..changeset/writable-project-subsessions.mdfor@sapiom/harnessminor.Security
will follow the
Security Policy for
private reporting.
AI assistance
OpenAI Codex implemented the focused SAP-3151 slices, tests, and documentation under the supplied project/ticket contracts. Every change was reviewed against the repository interfaces and validated with the focused, package-wide, browser, and root commands listed above.
Checklist
CONTRIBUTING.md, and this contribution follows the direct-PR or issue-first policy.any N/A checks above.