fix(server): harden multi-workflow mode startup and wiring#143
Merged
intel352 merged 2 commits intofix/issue-71-dead-api-wiringfrom Feb 23, 2026
Merged
fix(server): harden multi-workflow mode startup and wiring#143intel352 merged 2 commits intofix/issue-71-dead-api-wiringfrom
intel352 merged 2 commits intofix/issue-71-dead-api-wiringfrom
Conversation
4 tasks
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix server to implement multi-workflow mode API wiring
fix(server): harden multi-workflow mode startup and wiring
Feb 23, 2026
intel352
added a commit
that referenced
this pull request
Feb 23, 2026
* fix(server): implement multi-workflow mode API wiring (closes #71) Replace the dead TODO block in cmd/server/main.go with a working implementation that connects to PostgreSQL via store.NewPGStore, runs database migrations, bootstraps an optional admin user on first run, starts the api.NewRouter on a dedicated port (--multi-workflow-addr, default :8090), and shuts down cleanly alongside the single-config engine. New flags: --multi-workflow-addr New imports: apihandler (api package), bcrypt, time Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(server): harden multi-workflow mode startup and wiring (#143) * Initial plan * fix(server): address review comments on multi-workflow mode wiring Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-workflow mode had several gaps: the engine manager was never wired into the API (deploy/stop only updated DB status), admin bootstrap masked real DB errors, shutdown had no timeout, port conflicts failed silently, and single-config mode ran concurrently instead of being excluded.
API layer — engine manager wiring
Added
EngineRunnerinterface to theapipackage and wired it throughConfig.Engine→WorkflowHandler:DeployandStophandlers now call the engine before persisting the status change. Without an engine set (e.g. tests, legacy path) behaviour is unchanged.cmd/server/main.go— startup hardeninglog.Fatalwhen--jwt-secretis empty — tokens would be forgeable otherwiseNewPGStore+migrator.Migrateuse a 30-secondcontext.WithTimeoutinstead ofcontext.Background()errors.Is(err, evstore.ErrNotFound)now gates creation; any other error is fatal rather than silently retriednet.Listencalled before the deferred cleanup block — port conflicts are fatal immediatelyapiServer.Shutdown+engineMgr.StopAllshare a 30-second timeout context; deadline exceeded is logged as a warningSIGINT/SIGTERMthenreturns, preventing single-config mode from running alongside it💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.