Skip to content

feat: materialize workspace project sessions#2224

Closed
neversettle17-101 wants to merge 3 commits into
mainfrom
ao/agent-orchestrator-19/workspace-projects-backend
Closed

feat: materialize workspace project sessions#2224
neversettle17-101 wants to merge 3 commits into
mainfrom
ao/agent-orchestrator-19/workspace-projects-backend

Conversation

@neversettle17-101

Copy link
Copy Markdown
Collaborator

Summary

  • add an optional workspace-project adapter contract for root-plus-child repo worktree materialization
  • create workspace project sessions as one root worktree plus one child worktree per registered workspace repo, all on the same session branch
  • persist session_worktrees rows for every created repo and roll back all worktrees when spawn fails after materialization

Scope

This is the first backend slice for #2222. It does not yet implement multi-repo kill/restore/save lifecycle, SCM/PR aggregation across child repos, or frontend/API exposure.

Tests

  • cd backend && go test ./internal/session_manager ./internal/adapters/workspace/gitworktree
  • cd backend && go test ./...

Closes part of #2222

@neversettle17-101

Copy link
Copy Markdown
Collaborator Author

Claiming this PR to continue the remaining backend workspace-project work from #2222. I’ll keep the next slice focused and update this branch with tests.

@neversettle17-101 neversettle17-101 self-assigned this Jun 27, 2026
@neversettle17-101

Copy link
Copy Markdown
Collaborator Author

Correction to the previous comment: shell expansion stripped some backticked text while posting.

Pushed CI fixes in aad293b.

What changed:

  • added the missing comments for exported workspace project port types that revive flagged
  • fixed Unix process liveness so ao stop treats zombie daemon children as stopped; this resolves the native E2E TestE2E_Lifecycle timeout where the daemon had exited but the test parent had not reaped it yet
  • added a processalive regression test for zombie handling

Local verification:

  • cd backend && go test -tags e2e -run TestE2E_Lifecycle -v ./internal/cli
  • cd backend && go test -tags e2e ./internal/cli
  • cd backend && go test ./internal/processalive ./internal/session_manager ./internal/adapters/workspace/gitworktree
  • npm run lint

Remaining #2222 work is still separate from this PR's current backend slice: multi-worktree teardown/restore, SCM/PR repo-aware observation and claim, root change flow, and status aggregation.

@neversettle17-101 neversettle17-101 force-pushed the ao/agent-orchestrator-19/workspace-projects-backend branch from 098bf9a to 30909c0 Compare June 27, 2026 18:09
…-19/workspace-projects-backend

# Conflicts:
#	backend/internal/session_manager/manager.go

@neversettle17-101 neversettle17-101 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: approve (no blocking issues).

Solid, well-structured addition. CreateWorkspaceProject/DestroyWorkspaceProject provision the root-as-repo parent plus children with a shared branch, the branch-collision resolver picks a name free in every repo, and the spawn rollback path is threaded through destroySpawnWorkspace for all failure points. ListWorkspaceReposCreateWorkspaceProject wiring and the session_worktrees cascade FK make partial-failure cleanup safe. The packages build cleanly and the new tests cover the create/destroy and zombie paths.

A couple of minor, non-blocking observations below.

if err != nil {
for i := len(created) - 1; i >= 0; i-- {
_ = w.forceDestroyPath(ctx, created[i].repoPath, created[i].outputPath)
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: forceDestroyPath removes the worktree + dir but leaves the -b branch ref created by worktreeAddNewBranchArgs in each already-created repo. On a partial-create rollback those branches are leaked; a retry then resolves to branch-2 via workspaceProjectBranch. Not harmful (consistent with how Destroy leaves branches generally), but worth a comment or a branch -D on rollback if you want clean retries.

}

func isZombie(pid int) bool {
out, err := exec.Command("ps", "-o", "stat=", "-p", strconv.Itoa(pid)).Output()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isZombie shells out to ps on every Alive() call. Current callers invoke Alive once per CLI command / runfile read, so the fork cost is negligible here — fine as-is. Flagging only so that if Alive ever moves onto a polling/reconcile hot path, this should switch to reading /proc/<pid>/stat on Linux to avoid a per-probe process spawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant