You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(server,workflows,web): surface bundled defaults on /api/workflows when no project context (#1618)
* fix(server,workflows,web): surface bundled defaults on /api/workflows when no project context (#1173)
GET /api/workflows short-circuits to an empty array when there is no
`cwd` query param and no registered codebases. The handler never
reaches discovery, so bundled defaults are not surfaced and the UI
renders a misleading "Add workflow definitions to .archon/workflows/"
empty state on first run — even though the bundled YAML files are
present on disk.
This change:
- Threads `cwd: string | null` through `discoverWorkflows` and
`discoverWorkflowsWithConfig`. When `cwd` is `null` the discovery
function loads bundled + home scopes and skips the project step
cleanly (no path-join with an empty cwd, no read-error noise).
- Removes the early-return in the GET handler. When no project
context exists, it now calls `discoverWorkflowsWithConfig(null, ...)`
so the response carries the bundled set instead of `[]`.
- Distinguishes the empty-state copy in `WorkflowList` so the rare
case where the list is genuinely empty reads correctly. With a
project selected: "No workflows found in this project. Add
workflow definitions to .archon/workflows/ in the project root."
Without a project: "No workflows are available. Bundled defaults
should appear here automatically; if they do not, check that
`defaults.loadDefaultWorkflows` is enabled in your config."
Tests cover both the API (new `falls back to null cwd when no cwd
query and no codebases registered` case in `api.workflows.test.ts`)
and the discovery layer (new `discoverWorkflows with null cwd` block
in `loader.test.ts` asserting no project-source entries and no
project-step read errors).
* test(workflows): assert bundled defaults surface when cwd is null
The second test in the null-cwd discovery group only verified that
project-source workflows are absent. That assertion would still pass
if the bundled-defaults loader silently regressed.
Add an explicit `bundled` source-label assertion so the test catches
that regression directly.
* fix(workflows): address review on #1618
- api.md: document cwd-omitted behavior so the empty-state case is discoverable
- workflow-discovery.ts: docstring explains loadDefaults default rather than just naming the skipped branch
- api.workflows.test.ts: mockDiscoverWorkflows accepts string | null to match the wider signature
- api.ts: drop trailing period inside the multi-line inline comment
- CHANGELOG.md: add the #1173 Fixed entry under [Unreleased]
- loader.test.ts: add a regression test that asserts loadConfig is not invoked when cwd is null
* test(workflows): tighten null-cwd assertions + drop rot-prone refs
Address Wirasm's polish review on #1618:
- loader.test.ts: assert result.workflows.length === 0 in the
loadDefaults:false case so the test no longer passes if bundled
defaults are accidentally loaded.
- loader.test.ts: drop the inline (issue #1173) reference and the
workflow-discovery.ts file+line pointer from the two comments
that risk rotting on future refactor.
- api.workflows.test.ts: drop the inline (issue #1173) reference.
- CHANGELOG: append positive framing to the #1173 line so the
entry reads as "what works now" not just "what no longer breaks".
-**Pi concurrency + error surfacing**: SDK error messages now surface to the user instead of being masked, and Pi concurrency is capped to prevent cascade failures (#1572).
39
39
- Chat hydration shows newest messages instead of oldest (#1532).
40
40
-`GET /api/workflows/:name` now resolves home-scoped (`~/.archon/workflows/`) workflows that were previously invisible to the Web UI builder (#1405).
41
+
-`GET /api/workflows` no longer returns an empty array when no `cwd` query param is provided and no codebases are registered — bundled and home-scoped workflows now surface correctly on first run, making the workflow picker functional on first launch before any project is registered (#1173).
-`cwd` (optional) -- Working directory to discover project-specific workflows
206
206
207
+
When `cwd` is omitted, Archon returns bundled default workflows and any from `~/.archon/workflows/` (home-scoped). Project-specific workflows require either the `cwd` query param or a registered codebase, so the endpoint is useful on first launch before any project is registered.
208
+
207
209
Returns `{ workflows: [...], errors?: [...] }`. The `errors` array contains any YAML parsing failures encountered during discovery.
0 commit comments