Skip to content

fix(flow): stop blaming a stale engine for a project that is not a repository - #22

Merged
SeeRay11 merged 1 commit into
devfrom
nongit-agent-check
Sep 8, 2026
Merged

SeeRay11 merged 1 commit into
devfrom
nongit-agent-check

Conversation

@SeeRay11

@SeeRay11 SeeRay11 commented Sep 8, 2026

Copy link
Copy Markdown
Owner

A project folder the server does not recognise as one — most often a folder that is simply not a git repository — answers GET /api/agent with zero agents, built-in ones included. Every named card then read as missing, and preflight failed the run with the stale-config message:

it reads its config once at boot, so a merged agent stays invisible until it restarts

Restarting changes nothing. That is the expensive part: the sentence sounds right, so the next half hour goes into the restart loop rather than into the directory.

The run was usually fine. A session resolves its config from the engine's own cwd rather than from OPENFLOW_PROJECT, so the agents were there for the drain the whole time — only the check, which is directory-scoped, disagreed. Same split FLOW.md already documents for agents, skills and provider overrides, surfacing in the check rather than the run.

What changed

  • agentsUnscoped() (src/server/client.ts) — a second client built with no directory, so it reads the list the drain will actually have.
  • unknownAgents treats an empty list as its own case. It asks the unscoped read before failing anything, and the cards proceed when the names are there. Only when they are not does it stop the run — and then it says git init, quotes no restart command, and does not call onEngineStale, because that dialog offers the one fix that cannot work here.
  • A non-empty list missing one name is still the ordinary stale-config case and still says restart.
  • mergeAgents (src/app.tsx) splits the same two cases after a write.
  • A host with no unscoped read (an older build, a test double) keeps the old message — the right answer whenever the directory is a real project.

Measured

Against a live opencode serve on :4096, 2026-09-08:

read agents
x-opencode-directory: <non-git temp dir> 0
x-opencode-directory: C:/Users/seara/OpenFlow 49
no directory header at all 49

Verification

Four tests in engine.test.ts pin both new branches and the two cases that must not change: the drain rescuing an empty scoped list, git init with no onEngineStale when it does not, and a missing name in a non-empty list still saying restart.

bun test — 1045 pass, 0 fail. bun run typecheck — clean.

🤖 Generated with Claude Code

…pository

A project folder the server does not recognise as one — most often a folder
that is simply not a git repository — answers `GET /api/agent` with zero
agents, built-in ones included. Every named card then reads as missing, and the
preflight failed the run with the stale-config message: "it reads its config
once at boot ... restart". Restarting changes nothing, which is the expensive
part — the sentence sounds right, so the next half hour goes into the restart
loop rather than into the directory.

The run was usually fine. A session resolves its config from the engine's own
cwd rather than from OPENFLOW_PROJECT, so the agents were there for the drain
the whole time; only the check, which is directory-scoped, disagreed.

- `agentsUnscoped()` in `src/server/client.ts` — a second client built with no
  `directory`, so it reads the list the drain will have.
- `unknownAgents` treats an empty list as its own case: it asks the unscoped
  read before failing anything, and the cards proceed when the names are there.
  Only when they are not does it stop the run, and then it says `git init`,
  quotes no restart command, and does not call `onEngineStale` — that dialog
  offers the one fix that cannot work here. A non-empty list missing one name
  is still the ordinary stale-config case and still says restart.
- `mergeAgents` in `src/app.tsx` splits the same two cases after a write.
- A host with no unscoped read (an older build, a test double) keeps the old
  message, which is the right answer whenever the directory is a real project.

Measured against a live engine 2026-09-08: a non-git directory returned 0
agents, this repo returned 49, and the same read with no directory header
returned the same 49.

Four tests in `engine.test.ts` pin both branches and the two cases that must
not change. Full suite 1045 pass, 0 fail; typecheck clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@SeeRay11
SeeRay11 merged commit 793b6d1 into dev Sep 8, 2026
2 checks passed
@SeeRay11
SeeRay11 deleted the nongit-agent-check branch September 8, 2026 01:59
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