feat: implement actor_id resume in run/spawn + fix turnCount#1563
Open
faceair wants to merge 1 commit into
Open
feat: implement actor_id resume in run/spawn + fix turnCount#1563faceair wants to merge 1 commit into
faceair wants to merge 1 commit into
Conversation
- actor.ts: add resume branch in run/spawn execute path — when op.actor_id exists and findActor finds an idle actor, call promptOps.prompt with the existing actorID instead of spawning a new actor. run blocks on result; spawn uses Effect.runFork for fire-and-forget. Both wrapped in runTurn for registry status/turnCount/lastOutcome updates. - actor.ts: add sessionId/actorId to send metadata for TUI card navigation - turn.ts: call registry.updateTurn in runTurn so turnCount increments on every turn (was defined but never called — turnCount was always 0) - actor.test.ts: update dead-code test to real resume test - spawn resume: provide EffectLogger.layer to prevent stdout log pollution
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.
Closes #1562
Type of change
What does this PR do?
Makes the
actor_idparameter onrun/spawnactually work. Previously it was dead code — the schema said "resume" but execute never read it.When
actor_idis provided andfindActorfinds an idle actor, the resume branch callspromptOps.prompt({ agentID: actor_id })instead ofactor.spawn().runblocks on the result;spawnfires a background fiber. Both are wrapped inrunTurnso the registry updates status/lastOutcome and publishesActorStatusChanged— without this,waitnever resolves because it subscribes to that event.Also fixes
turnCountalways being 0:registry.updateTurnwas defined but never called. Added the call insiderunTurn(shared entry point for all actor turns).spawnresume providesEffectLogger.layerto the forked fiber to prevent Effect logs from going to stdout and corrupting the TUI.How did I verify your code works?
bun run typecheckpasses (12 packages)bun test test/tool/actor.test.ts test/tool/actor-send.test.ts— 18 pass, 0 failactor runcreates sidekick-N,actor runwithactor_id=sidekick-Nreuses it (same ID returned, conversation context preserved)actor spawnwithactor_idresumes in background,waitreturns result + correctturnCount+lastOutcome: successChecklist