fix(server): include home-scoped workflows in GET /api/workflows/:name#1560
fix(server): include home-scoped workflows in GET /api/workflows/:name#1560thecodeartificerX wants to merge 1 commit into
Conversation
The GET route only checked project-scoped (cwd/.archon/workflows/) and
bundled defaults, falling through to 404 for workflows at ~/.archon/workflows/.
The Web UI then rendered an empty workflow object and produced misleading
Zod errors ("workflow name is required", "workflow description is required",
"at least one node is required") even though the workflow loads fine in
the CLI and the discovery layer (which correctly lists it with source:
'global').
Mirror the PUT /api/workflows/:name route (which already defaults saves
to getArchonHome() when no cwd matches) by adding a home-scoped lookup
between the project and bundled tiers, returning source: 'global'.
Discovery priority (project > global > bundled) is preserved.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe API's ChangesHome-Scoped Workflow Resolution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
|
@thecodeartificerX Duplicate of #1525 |
Summary
GET /api/workflows/:namereturns 404 for any workflow at~/.archon/workflows/. The Web UI then renders an empty workflow object, surfacing misleading Zod errors ("workflow name is required", "workflow description is required", "at least one node is required") even though the same workflow loads and runs correctly via the CLI.archon workflow listwithsource: 'global', validate cleanly, and execute end-to-end — but cannot be opened in the workflow builder UI.getArchonHome()when no cwd matches.discoverWorkflows()inpackages/workflows/src/workflow-discovery.ts). No subfolder lookup added — that would be a separate change touching PUT too.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
api.ts:GET /workflows/:namegetHomeWorkflowsPath()<ARCHON_HOME>/workflows/<name>.yamlapi.ts:GET /workflows/:nameparseWorkflow()Label Snapshot
risk: lowsize: XSserverserver:routes-api-workflowsChange Metadata
bugserverLinked Issue
(No issue filed — discovered during dogfooding by a user authoring a home-scoped workflow per the documented
~/.archon/workflows/flow.)Validation Evidence (required)
Full
bun run validatewas run; 4 pre-existing failures in@archon/workflows(DAG Loader -- cycle detection > accepts valid DAG …×3 and one script-node test) are present onorigin/devwithout this patch and are unrelated to this change (verified by stashing the patch and re-running). This PR touches onlypackages/server/src/routes/api.ts.Manual verification:
Web UI workflow builder now opens the workflow without Zod errors.
Security Impact (required)
getHomeWorkflowsPath()which is already read bydiscoverWorkflows(). Filename is derived from a route param that already passesisValidCommandName(), so no new path-traversal surface is introduced.Compatibility / Migration
Human Verification (required)
What was personally validated beyond CI:
source: 'global'source: 'project'source: 'bundled'~/.archon/workflows/personal/foo.yaml) — discovery surfaces these but GET still 404s. PUT also writes only to top level. Out of scope for this PR; would need a paired GET+PUT change.Side Effects / Blast Radius (required)
GET /api/workflows/:name. The Web UI workflow builder benefits; the CLI was already correct.workflow-discovery.ts. This was already the case inarchon workflow listand execution; the GET route was the outlier.workflow.fetch_home_failed) added for non-ENOENT read errors.Rollback Plan (required)
git revert <this commit>. Single-file, additive change with no migrations.GET /api/workflows/:namefor any user with a home-scoped workflow → checkworkflow.fetch_home_failedlog entries.Risks and Mitigations
Summary by CodeRabbit
Release Notes