ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
> Generated by super-planner. Source: roadmap.md (Phase 6.5). > Last updated: 2026-06-24 after 3-model council synthesis (GPT-5.5, Claude Opus 4.6, GPT-5.3-Codex) + grill-me session.
Status: ✅ done — unit/integration green (171 tests), typecheck/layers/eslint clean, live E2E (fork-and-continue + restart restore) verified 2026-06-24. See Implementation Notes.
Make ClaudeAgent.createSession({ fork }) work. Today it throws TODO: Phase 6.5 at claudeAgent.ts (the if (config.fork) branch in createSession). Fork takes an existing Claude session plus a protocol turnId (the last KEPT turn N — keep [0..N] INCLUSIVE), forks the SDK's JSONL transcript at the matching SDK envelope uuid, and brings up a brand-new session that the SDK loads via Options.resume. This honours the workbench's "truncate-by-fork" semantic — Claude has no in-place truncateSession, so fork is the only truncate path.
The chosen approach walks the source transcript on demand (via getSessionMessages) to translate turnId → SDK envelope uuid, because the SDK's forkSession({ upToMessageId }) accepts an envelope uuid, not a protocol turn id, and offers no translation helper. A prior heuristic that inferred turn boundaries by scanning raw JSONL frame shapes was fully reverted; this plan is the contract-based replacement and must not reintroduce that heuristic.
In scope
forkSession(sessionId, options?) on IClaudeAgentSdkService + IClaudeSdkBindings + the passthrough impl.SessionMessage[] and returns the fork-anchor upToMessageId for a given protocol turnId (the uuid of the last `type:'assistant'` envelope of turn N, INCLUSIVE).createSession({ fork }) branch: source-session sequencing, transcript fetch, anchor resolution, forkSession call, eager materialization via _resumeSession, inherited-metadata write.forkSession.Out of scope
<parent>/subagent/<toolCallId> URI is not supported; reject early (Phase 12 owns subagent transcripts).remapTurnIds (copilotAgent.ts ~1156) operates on a per-turn event-id DB that Claude does not maintain. config.fork.turnIdMapping is a no-op for Claude.getSessionMessages SDK binding) ✅.forkSession(_sessionId, _options?) (sdk.d.ts:685), ForkSessionOptions.upToMessageId (INCLUSIVE, sdk.d.ts:690-693), and ForkSessionResult.sessionId (resumable via query({ options: { resume } }), sdk.d.ts:700-703).Add forkSession to the Claude SDK shim. Add a pure transcript resolver — co-located in claudeReplayMapper.ts so it shares parseSessionMessage and the exact turn-boundary rule the replay builder uses (Turn.id = SessionMessage.uuid of the user-text envelope at claudeReplayMapper.ts:199). In createSession, replace the throw with: queue on the source session id, fetch the source transcript with { includeSystemMessages: true }, resolve the anchor uuid, call forkSession(sourceId, { upToMessageId }), write the inherited overlay (model / permissionMode / agent / customizationDirectory) to the new session URI, then delegate to _resumeSession(newSessionId, newSessionUri) — which materializes eagerly with Options.resume and fires onDidMaterializeSession. Fork is therefore non-provisional: it returns a fully-materialized session, not a deferred one (CONTEXT M9).
1. ✓ Add the `forkSession` SDK binding. Extend the interface, the narrowed bindings, and the passthrough.
forkSession(sessionId: string, options?: ForkSessionOptions): Promise<ForkSessionResult> to IClaudeAgentSdkService (line 41) and IClaudeSdkBindings (line 79); add the passthrough on ClaudeAgentSdkService (delegates to sdk.forkSession). Import ForkSessionOptions / ForkSessionResult types (line 6).{ sessionId } and typecheck-client is clean (the bindings interface is structurally checked against the SDK module on import()).2. ✓ Add the pure fork-anchor resolver. New exported function in the replay mapper.
resolveForkAnchorUuid(messages: readonly SessionMessage[], turnId: string): string | undefined.parseSessionMessage):currentTurnId; on every 'user-text' parsed message set currentTurnId = msg.uuid (the same rule that makes Turn.id at claudeReplayMapper.ts:199).currentTurnId === turnId, record each 'assistant' message's uuid as the running candidate. 'user-tool-results' and 'system-notification' do not flip the turn (mirrors claudeReplayMapper.ts:103-126).'user-text' after the target turn is seen, or at end-of-array.turnId (the user-text envelope uuid) itself — INCLUSIVE keep of [0..N] still holds. If turnId was never seen, return undefined.3. ✓ Implement the fork branch in `createSession`. Replace the throw.
isSubagentSession(config.fork.session) is true; or the source session is present in _sessions but still provisional (no transcript to anchor on)._sessionSequencer.queue(sourceSessionId, async () => { … }) — serialize against the source like Copilot (copilotAgent.ts ~1118) so a concurrent sendMessage can't mutate the transcript mid-read.const messages = await this._sdkService.getSessionMessages(sourceSessionId, { includeSystemMessages: true }); const upToMessageId = resolveForkAnchorUuid(messages, config.fork.turnId); throw a clear error if undefined.const { sessionId: newSessionId } = await this._sdkService.forkSession(sourceSessionId, { upToMessageId }).this._metadataStore.read(config.fork.session)), then write the inherited fields to the new session URI: this._metadataStore.write(newSessionUri, { model, permissionMode, agent }) before _resumeSession (resume reads the new URI's overlay and materialize({ isResume: true }) skips overlay writes — claudeAgentSession.ts materialize). Do not inherit customizationDirectory (see Decisions). Apply config.model / config.agent overrides over the inherited values when supplied.4. ✓ Extend the test fake + add fork tests.
forkSession to FakeClaudeAgentSdkService (capture calls, programmable result + rejection; default { sessionId: 'forked-…' }). It already has sessionMessagesById / getSessionMessagesCalls for transcript fixtures.'createSession({ fork }) throws TODO: Phase 6.5 with no side effects' test (~line 1308) into success-path assertions.getSessionMessages(src, { includeSystemMessages: true }); calls forkSession with the resolved uuid; materializes with resume in the startup options; fires onDidMaterializeSession with the new URI; returns a non-provisional result; inherits source model/permissionMode; subagent-URI source rejects; provisional source rejects; turnId not found rejects.5. ✓ Add resolver unit tests.
user-tool-results between assistant envelopes does not flip the turn; a system-notification mid-turn does not flip the turn; user-only target turn (no assistant) falls back to the user-text uuid; turnId not found → undefined; empty transcript → undefined; CLI-echo user envelopes are skipped by the shared parser.typecheck-client / valid-layers-check / eslint / hygiene clean.| Path | Change | Notes | |------|--------|-------| | claudeAgentSdkService.ts | modify | Add forkSession to interface + bindings + passthrough | | claudeReplayMapper.ts | modify | Add exported resolveForkAnchorUuid() pure helper | | claudeAgent.ts | modify | Replace the config.fork throw in createSession with the fork flow | | claudeAgent.test.ts | modify | Fake forkSession; convert the throw test; add fork tests | | claudeReplayMapper.test.ts | modify | Add resolveForkAnchorUuid fixtures | | claudeAgent.integrationTest.ts | modify | Add a forkSession no-op stub on ProxyRoundTripSdkService to satisfy the widened interface |
Resolved during the grill-me session:
user-text flips the turn, user-tool-results / system-notification do not). Co-locating with parseSessionMessage keeps that rule as a single source of truth; a separate module would risk parser drift (the precise failure mode the reverted heuristic hit). The dissenting model's "avoid overloading the mapper" concern is outweighed by the drift risk.upToMessageId is INCLUSIVE and accepts any envelope uuid; anchoring on the user-text envelope keeps turns [0..N] including that user message, which is the correct keep semantic. Throwing here would needlessly fail a legitimate "fork after my last (unanswered) message" case.remapTurnIds rewrites a per-turn SDK-event-id DB; Claude stores no such map and the SDK's forkSession already remaps every internal message uuid. Document with a one-line comment at the call site.materialize({ isResume: true }) skips the overlay write and _resumeSession reads the *new* session's overlay (which is empty right after fork). Writing the inherited { model, permissionMode, agent }_resumeSession reads cwd from getSessionInfo(newSessionId) and throws if it's missing (claudeAgent.ts _resumeSession); SDKSessionInfo.cwd is optional (sdk.d.ts:3929). forkSession copies transcript messages, so the forked session file *should* carry the parent's cwd — but this is unverified SDK behavior. Mitigation: the E2E scenario explicitly checks fork succeeds and the working directory matches; if getSessionInfo returns no cwd for forks, the fork branch must pass config.workingDirectory ?? sourceWorkingDirectory explicitly into a fork-aware resume rather than relying on _resumeSession's SDK read. Decide based on the live run before declaring done.ReplayBuilder.consume, a fork anchors on the wrong turn. Mitigation: the resolver reuses parseSessionMessage and lives in the same file; add a cross-check fixture that runs a transcript through both mapSessionMessagesToTurns (asserting Turn.ids) and resolveForkAnchorUuid (asserting the matching anchor) so a future change to one without the other fails.forkSession uuid, resume startup option, onDidMaterializeSession fire, non-provisional result, metadata inheritance, and the three rejection paths (subagent source, provisional source, turnId-not-found).typecheck-client, valid-layers-check, npm run eslint, npm run gulp hygiene — all clean.Run via the runTests tool against the two test files, or scripts/test.sh --grep "Phase 6.5|fork|resolveForkAnchorUuid".
Workspace skills available:
Scenario — fork-and-continue (mirrors smoke.md conventions):
1. Use launch to start Code OSS Agents (./scripts/code.sh --agents), open the Agents window, pick the Claude agent, create a session, and send three sequential prompts so the transcript has ≥3 turns (e.g. "say apple", "say banana", "say cherry"), letting each turn settle. Screenshot the full transcript. 2. Trigger fork at turn 2 (the "banana" turn) via the workbench's fork/edit-and-resubmit affordance (keep [0..1] inclusive semantic) — or, if the affordance isn't wired for Claude yet, drive createSession({ fork: { session, turnId, turnIndex } }) through the test harness against the live agent host. 3. Confirm a new session appears, pre-populated with turns 0–1 (apple, banana) and not turn 2's follow-up (cherry). Screenshot for comparison. 4. Send a new prompt on the forked session ("say date") and confirm it lands cleanly and the assistant responds — validates the forked session is live (resume worked) and accepts new turns. 5. Use code-oss-logs to read the agent-host log for the run; grep for [Claude] warnings during fork — none expected on the happy path. Confirm the forked session's working directory matches the source (validates the cwd-survival risk). 6. Quit and relaunch the agent host; re-open the forked session and confirm its transcript restores (turns 0–1 + the new turn), exercising fork ✕ Phase 13 restoration together.
_None remaining._ All grilling-phase questions resolved — see Decisions. The one residual unknown (forked-session cwd survival) is tracked as a Risk with a concrete decision point in the E2E run, not an open design question.
Turn.id)getSessionMessages binding, id-correctness note): ./phase13-plan.mdgetNextTurnEventId + DB vacuumInto + remapTurnIds): ../copilot/copilotAgent.ts (createSession fork branch ~1108-1170)Implemented via super-implementer + TDD. All unit / integration suites green (170 tests across claudeAgent.test.ts, claudeReplayMapper.test.ts, claudeSubagentResolver.test.ts), typecheck-client clean, valid-layers-check clean, eslint clean on all changed files.
Production:
resolveForkAnchorUuid(messages, turnId) reusing parseSessionMessage (single-pass, seenTarget + last-assistant accumulator, fallback to the user-text uuid, undefined when the turn is absent).forkSession to IClaudeAgentSdkService + IClaudeSdkBindings + the passthrough impl (validated against the real SDK by the existing AssertBindingsMatchSdk compile-time guard).config.fork throw in createSession with a delegation to a new private _forkSession(config, fork) method: subagent/provisional rejection, source-session sequencing, transcript fetch, anchor resolution, forkSession, inherited-overlay write (model/permissionMode/agent, NOT customizationDirectory), then _resumeSession for eager materialization. turnIdMapping intentionally ignored (documented at the method).Tests:
resolveForkAnchorUuid suite (10 fixtures: fork at each of 3 turns, multiple-assistant turn, tool-result non-boundary, system-notification non-boundary, user-only fallback, not-found, empty, CLI-echo skip).forkSession to FakeClaudeAgentSdkService (call capture + programmable result/rejection); replaced the Phase 6.5 throw test with 7 fork tests (happy-path snapshot, last-turn anchor, source-permissionMode inheritance, config-model override persistence, turnId-not-found rejection, subagent-source rejection, provisional-source rejection); added a module-scope forkSourceMessages helper.IClaudeAgentSdkService broke conformance of FakeSdkService in claudeSubagentResolver.test.ts and the two inline IClaudeSdkBindings literals in claudeAgent.test.ts's SDK-service forwarding tests, plus the planned claudeAgent.integrationTest.ts stub. All are trivial mechanical conformance stubs (throw 'not implemented' / { sessionId }), surfaced here per the no-silent-drift rule._resumeSession / _materializeProvisional orchestration methods. The genuinely unit-testable pure logic (resolveForkAnchorUuid) is already a free exported function, so the avoid-private-methods principle is satisfied without extraction. avoid-private-methods: clean (manual audit; the skill is not installed in this workspace)._resumeSession" Decision) called for fork to call _resumeSession and materialize eagerly, firing onDidMaterializeSession from inside createSession. The live E2E caught two ordering bugs with that design: _resumeSession runs *inside* provider.createSession, but AgentService.createSessionRan the fork-and-continue scenario against a live, authenticated Agents window (launch skill, short TMPDIR per the macOS socket gotcha) and read the agent-host log (code-oss-logs).
1. Created a Claude (Local Agent Host) session, sent 3 turns (apple → banana → cherry); each turn settled with the expected one-word reply. Session materialized on first send. 2. Clicked the workbench's "Fork conversation from this point" affordance on the banana turn → a new "Forked: …" session appeared, pre-populated with apple + banana and not cherry (correct [0..N] INCLUSIVE truncation). So the fork affordance is wired for Claude. 3. Sent a new turn on the fork ("date" / "elderberry") → landed cleanly and the assistant responded, confirming Options.resume brought the forked transcript live. 4. Quit + relaunched the agent host, re-opened the forked session → transcript restored (fork ✕ Phase 13 replay), and the fork affordance worked again on the restored session. 5. `cwd`-survival Risk: RESOLVED. getSessionInfo(forkedId).cwd returned the parent's working directory; the forked session's working dir matched the source. No explicit-workingDirectory fallback was needed. 6. Log: clean. Zero [Claude] warnings/errors across both runs; the two ordering warnings below are both at count 0 (see drift note).
await this._resumeSession(newSessionId, newSessionUri) — eager materialize + onDidMaterializeSession fire.{ session: newSessionUri, workingDirectory, ...(project ? { project } : {}) } (NOT provisional: true).config.fork.turnIdMapping is intentionally ignored (no Claude per-turn event-id store).config.modelconfig.agent_metadataStore.writecustomizationDirectory points at the per-session synced client-customization dir from Phase 11; copying it would couple two sessions to one mutable on-disk dir that may be stale or cleaned up independently. The forked session re-syncs its own customizations on first setClientCustomizations / materialize, matching how a fresh session bootstraps. Inherit only model / permissionMode / agent.config.fork when the source has no turns (treating it as a fresh create — see copilotAgent.ts ~1110), so this case shouldn't reach the agent. When it does, a hard error (Cannot fork a provisional/never-sent session) surfaces the contract violation rather than masking it with a silent fresh-create fallback._resumeSession's SDK cwd read rather than speculatively threading an explicit workingDirectory. The E2E run (Verification step 5) confirms cwd survives the fork; only if it doesn't does the fork branch grow an explicit-workingDirectory resume path. Avoids speculative defensive code._sessions, calls materialize({ isResume: true }), and fires onDidMaterializeSession (claudeAgent.ts _resumeSession). Fork is "prepare overlay, then delegate."_sessionSequencer.queue(sourceSessionId, …)) so the transcript read + fork can't race an in-flight sendMessage on the source. The new session id is SDK-generated and registered inside the closure; no key collision.upToMessageIdSessionMessage.uuidmsg_…msg.uuidmessage.idmsg_…getSessionMessages returns [] for provisional). Mitigation: reject provisional sources before the SDK call; external CLI sources with no overlay DB still fork fine (overlay read returns {}); _resumeSession already throws clearly when the SDK session info is absent.createSessiononDidMaterializeSession[AgentService] onDidMaterializeSession for unknown sessionsession/serverToolsChanged[AgentHostStateManager] Action for unknown sessionforkSessionQueryQuerysendMessage_resumeSession_doResumeSession_forkSessionworkingDirectoryprojectgetSessionInfo(newSessionId)sendMessage_resumeSessionAgentServicesendMessagestartupResume === 'forked-1'