test(acp): preserve resident recovery on final core - #1236
Open
sethkarten wants to merge 24 commits into
Open
Conversation
This was referenced Aug 11, 2026
sethkarten
changed the base branch from
v080/final-core-main-project-mcp-hardened
to
main
August 11, 2026 18:05
7 tasks
sethkarten
marked this pull request as ready for review
August 12, 2026 06:18
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9750558. Configure here.
This was referenced Aug 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Warning
BLOCKED ON CORE — topology-only reconstruction targeting
main. The five-path P1 delta is tests/docs/package-command only and depends on resident launch-environment production surfaces not yet present onmain. Expected test dependency failures are intentional evidence; do not merge until the required Core implementation lands.Topology
Base PR targeting
main, as required.c3ab0a13ff164598ac42c3cca2bc426cc5cccd6847dccfad4c0e71cd357f12d233ac44cc803af8c56fecbb81737f0473718e66c4265630812d90df05Exact incremental scope versus main
Only five paths:
packages/coding-agent/CHANGELOG.mdpackages/coding-agent/package.jsonpackages/coding-agent/test/acp-resident-lifecycle.test.tspackages/coding-agent/test/daemon-protocol.test.tspackages/coding-agent/test/daemon-supervisor-process.test.tsNo production
src/**path is included. Required Core APIs/semantics remain an explicit dependency.No live or paid evaluation was run.
Note
High Risk
Changes daemon supervisor worker recovery, credential persistence, and ACP lifecycle—security-sensitive paths where misbehavior could leak secrets or break session recovery after crashes.
Overview
Resident daemon workers no longer keep full launch environments or session runtime config on disk. New
sanitizeAgentSessionRuntimeConfigForDurableStorageandfilterPersistedDaemonLaunchEnvstrip secrets (tokens, headers, API keys, etc.) before supervisor and worker descriptors are written; startup re-sanitizes existing descriptors and may rewrite them.Recovery behavior changes for ownerless residents: a dead worker without a one-shot
launchEnvfrom a local client create goes tofailed(“Waiting for a client with fresh environment”) instead of auto-relaunching from ambient env or stale descriptors.reuseWorkerForCreatesingle-flights concurrent fresh resumes, merges transient env only for that recovery, and clears it after success or failure. Replacement launches use an allowlisted inherited env so the supervisor’s ambient credentials are not passed to workers.ACP / client wiring: reattachable ACP sessions (session file, not
--no-session) useresidentlifecycle viaisClientOwnedDaemonSession. Daemon create always receiveslaunchEnv; attach skips failed residents so resume can supply a new environment. Update-restart restore uses explicitlifecycle: "resident"and emptylaunchEnvas a recovery capability marker.Also kills tracked detached children on daemon socket shutdown, pins supervisor registry dir into worker env, and tightens session-path matching for restarted supervisors (ambiguity/conflict errors).
Tests add
acp-resident-lifecycle, expand supervisor monitor/process coverage, and adjust regressions to expect fail-closed then client-driven recovery.Reviewed by Cursor Bugbot for commit dc6f1a8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve resident worker recovery on final core with credential sanitization
launchEnv, rather than attempting to relaunch with stale or missing credentials.filterPersistedDaemonLaunchEnvand an allowlist (DAEMON_PERSISTED_LAUNCH_ENV_KEYS) so only non-secret env vars are written to durable worker descriptors; secrets are stripped on load, promotion, and persist.sanitizeAgentSessionRuntimeConfigForDurableStorageto redact credential-bearing fields (API keys, tokens, headers, AWS creds) from persisted session configs.isClientOwnedDaemonSessionhelper;createDaemonClientConnectionskips attaching to failed workers and issues acreatewith freshlaunchEnvinstead.launchEnvvia a create request to resume them.Macroscope summarized dc6f1a8.