Repository navigation
Adapter: find a project, launch a thread and read its status in-process #5
Copy link
Copy link
Closed
Labels
factory:pr-openPR is open and passed the gatePR is open and passed the gate
Description
Outcome
Factory code can start an agent session in its own worktree and read where it stands through softfac-shaped types, calling T3's services directly instead of the wire protocol.
Acceptance criteria
apps/server/src/factory/t3/sessions.tsprovides an Effect serviceFactorySessionswithfindProject(workspaceRoot),launch(request),status(threadId)andthread(threadId). Each has the meaning of the call with the same name on softfac'sSessionstrait insrc/t3.rs: the same inputs, and the run statusespreparing|queued|starting|running|waiting|completed|interrupted|failed|cancelled|rolled_back.statusreports the latest run (highest ordinal, leaving out a cancelled run that never started), that run's last assistant message, and the thread'sbranch,worktreePathandarchived.threadreports the thread fields alone and works when the run cannot be read.launchstarts a thread in a new worktree frombaseRef, or from the branch tip on origin whenstartFromOriginis set, infull-accessruntime mode and the default interaction mode, with the given model instance, model, title and first message, under the caller'scommandId. A secondlaunchwith the samecommandIdreturns the same thread and starts nothing.apps/server/src/factory/t3/paths.tsgives the base dir, the worktrees dir and the factory data dir<base>/factory, fromServerConfig.apps/server/src/factory/t3/sessions.contract.test.tsruns the real orchestration layers with the test provider frompackages/provider-testing. It launches a thread, waits for the run to complete, reads the last assistant message, checks the worktree exists on the branchstatusreports, and shows that a repeatedcommandIdstarts one thread.- The boundary test still passes: only files under
apps/server/src/factory/t3/import T3 internals.
Depends on
Notes
In-process entry points: ThreadLaunchService (orchestration-v2/ThreadLaunchService.ts), OrchestratorV2.dispatch, ProjectionStoreV2, EventSinkV2. See how ws.ts handles orchestration.launchThread and how orchestration-v2/http.ts answers GET /api/orchestration/threads/:id, and call the same services. PullRequestSyncReactor.ts is an in-process example. softfac's tests/fixtures/t3_thread_snapshot.json shows the fields it reads.
Reference
- softfac, the Rust factory this ports, pinned at
rawphp/softfac@bf273a1. Read it from a separate clone:git clone --filter=blob:none https://github.com/rawphp/softfac /tmp/softfac-ref && git -C /tmp/softfac-ref checkout bf273a1d93651992b4fc95b4dd6c111f8f3322cf. Itsdocs/lifecycle.md,docs/reference/ledger.mdanddocs/issues.mddescribe the behaviour; its tests pin it. - Design:
factory/docs/design.mdin this repo. - Upstream's
AGENTS.mdapplies. Run only the tests and typechecks for the paths you touch (vp test run <path>,vp run --filter t3 typecheck), never the repo-wide checks. - Edit no upstream file that is not listed in
factory/SEAMS. A new seam needs a line infactory/SEAMSand a reason in the PR body. - Port behaviour, not code: port the named test cases first (TypeScript, vitest /
@effect/vitest), then make them pass. Exact comment and ledger wording is ported as is.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
factory:pr-openPR is open and passed the gatePR is open and passed the gate
Activity
rawphp commentedon Oct 15, 2026
Factory status: pr-open
feat(factory): sessions adapter over T3's launch and projection services
test(factory): blank ids fail typed, last assistant message is the last
fix(factory): blank ids fail as the declared sessions errors