Skip to content

factory: no chat ever works in codeaf's own folder - #2578

Merged
santoshkumarradha merged 2 commits into
app/v3from
engine/af-chat-not-home
Nov 10, 2026
Merged

santoshkumarradha merged 2 commits into
app/v3from
engine/af-chat-not-home

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What was wrong

A factory chat with no checkout of its own fell back to its host's workspace, and that was never a project:

  • cmd/codeaf/appfactory_setup.go — the desk's own factory host was built with workspace: home.Dir(), so the codeaf home ITSELF, whatever the engine's cwd. This is the path the WorkAF desk takes.
  • cmd/codeaf/app_factory.go (newAppFactoryHost), cmd/codeaf/runner_command.go — os.Getwd(); cmd/codeaf/factory_run.go — the launch's workspace.
  • cmd/codeaf/factory_agentfield_run.go afRemote.mirror minted every AgentField step's chat with v3MintSession(bucket, r.workspace, r.workspace) and wrote r.workspace as the header's cwd, so every SWE-AF / RunOn step chat worked in ~/.codeaf.
  • The same fallback fed the foreman (foremanMaker) and a stage with no worktree (stageMaker.Open).

Every save of those chats ran the seal guard's secret scan over ~/.codeaf — graph.db, factory clones, bin/, credentials.json — into the key vault.

The fix

  • AgentField-run jobs work in the job's own empty folder, <floor>/chats/<job> — the folder talkFolder already used as its last resort, so no new layout. Step mirror chats always use it. A RunOn job's or all-AgentField pipeline's manager uses it too (factory.RunsElsewhere), even when this machine knows a checkout. The chat layer has no "no folder" mode (v3MintSession needs a workspace, and an empty one becomes a project bucket keyed on .), so an explicit empty folder is the option the code supports.
  • Hosts drop a workspace that is the codeaf home, above it or inside it (factoryHostWorkspace); the desk host now has none. The foreman falls back to <floor>/chats/foreman; a stage with no worktree falls back to its job's folder.
  • Guard: factoryFolderRefusal is asked by every factory mint site (talk/manager, stage, foreman, AgentField step). It refuses the codeaf home, any folder above it, and any folder inside it that is not strictly inside the floor's work/, repos/ or chats/. The error is a factory chat cannot work in codeaf's own folder (<dir>). Local jobs' worktrees, clones and recorded checkouts pass unchanged.
  • Existing chats that already name ~/.codeaf: internal/cellstore holdsHome now treats the codeaf home and its ancestors the way it treats the person's home. Such a chat seals only its own folder, so the scan never walks the home again, whichever door reopens it. Its tools still run there, and nothing is moved or deleted. It shows one notice of its own: "this folder holds codeaf's own folder, so its files are not saved with this chat · …". A folder inside the home, such as a job worktree, still seals as a project.

Manual

  • factory-agentfield.md: new section, "which folder an AgentField job's chat works in".
  • sessions-and-rewind.md: new section, "A chat opened in codeaf's own folder", which quotes the new notice.

Tests

  • cmd/codeaf/factory_chat_folder_test.go. With cwd = the codeaf home, an AgentField step's chat works in <floor>/chats/<id> (empty), not in cwd, not in a folder holding the home, and the header names it. A RunOn manager uses its own folder even when a checkout is known. Local job: its checkout, worktree and clone pass. The guard refuses the home, its parent, v3, the floor, repos, work and bin. A host started in the home gets no workspace. The foreman falls back to chats/foreman.
  • internal/cellstore/codeaf_home_test.go: the codeaf home and its parent are never sealed; a job worktree inside it is.
  • make pr-ready BASE=origin/app/v3 passed: the light gate, all of ./cmd/codeaf (8 shards) and all of ./internal/cellstore, every test on its first run. internal/manual and internal/namelaw are green too.

Touches near open PRs

internal/cellstore/engine.go and seat.go only. #2576 changes captureplan.go and guard.go, so the files do not overlap. Nothing under internal/factory/agentfield (#2573) is touched.

santoshkumarradha and others added 2 commits November 10, 2026 09:45
A factory chat with no checkout of its own fell back to its host's
workspace: os.Getwd for a window, worker and runner, and the codeaf home
itself (home.Dir()) for the desk's own factory. Every AgentField step's
mirror chat was minted there unconditionally, so on a desk each one
worked in ~/.codeaf and every save swept graph.db, the factory's clones
and credentials into the key vault.

AgentField-run jobs (RunOn or an all-AgentField pipeline) now work in
the job's own empty folder, <floor>/chats/<job>, which talkFolder already
used as its last resort; the foreman falls back to <floor>/chats/foreman.
Hosts drop a workspace that is the codeaf home, above it or inside it,
and every factory mint site asks factoryFolderRefusal, which refuses the
home, its ancestors, and anything inside it outside a job's worktree,
clone or own folder.

Chats that already name the home stop sweeping it on their next open:
cellstore's holdsHome now counts the codeaf home and its ancestors the
way it counts the person's home, so only the chat's own folder is
sealed. Nothing is moved or deleted.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <267109073+agentfield-bot@users.noreply.github.com>
Assisted-by: CodeAF
Co-Authored-By: CodeAF <267109073+agentfield-bot@users.noreply.github.com>
@santoshkumarradha
santoshkumarradha merged commit 344fb10 into app/v3 Nov 10, 2026
8 checks passed
@santoshkumarradha
santoshkumarradha deleted the engine/af-chat-not-home branch November 10, 2026 15:54
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