feat(engine): port /v1/bus/* and /v1/sessions to engine (Track 5 Phase 3)#39
Merged
chazmaniandinkle merged 1 commit intocogos-dev:mainfrom Apr 22, 2026
Conversation
…e 3)
Ports 9 bus routes + 2 session routes from root package to engine,
preserving byte-compat JSON shape for cog-sandbox-mcp bridge consumption.
Storage path unchanged (.cog/.state/buses/{bus_id}/events.jsonl).
Additive-only: root serve.go still registers these routes; after Phase 4
Makefile switch, the installed binary will serve them via engine instead.
Follows the Phase 1 / PR cogos-dev#23 and Phase 2 / PR cogos-dev#37 migration pattern.
chazmaniandinkle
pushed a commit
that referenced
this pull request
Apr 22, 2026
The installed cogos binary now builds from cmd/cogos/main.go (engine) rather than from root package. Root package still builds for tests + comparison, but the default `make build` / `make install` targets produce an engine-based binary. Prerequisites (all on main): - Phase 1 (#23): cogos emit migrated to engine - Phase 2 (#37): cogos mcp serve migrated to engine - Phase 3 (#39): /v1/bus/* + /v1/sessions migrated to engine Changes: - Makefile: default build target, all per-platform cross-compile targets (darwin/linux/android), and LDFLAGS -X path flip to github.com/cogos-dev/cogos/internal/engine.BuildTime. Smoke-test target drops `help` and `coherence check` subcommands which engine does not expose. - Dockerfile: multi-stage build updates matching Makefile (path + LDFLAGS). Dockerfile.e2e was already correct. - CHANGELOG: document cutover, subcommands gained / lost. Preserves the CLI entry point name (`cogos`) so hooks + .mcp.json continue to work without changes. Subcommands that only existed in root (dormant subcommands + anything not yet migrated) are no longer available in the installed binary — Phase 5 audits these for final deletion. Smoke-tested: engine binary serves /health, /v1/bus/send, /v1/bus/{id}/events in the shape the cog-sandbox-mcp bridge consumes.
chazmaniandinkle
pushed a commit
that referenced
this pull request
Apr 22, 2026
Deletes the serveServer type and all files that reference it as a method receiver, plus helpers that went orphan when the web was cut. Prerequisites (all on main): - Phase 1 (#23): cogos emit in engine - Phase 2 (#37): cogos mcp serve in engine - Phase 3 (#39): /v1/bus/* + /v1/sessions in engine - Phase 4 (#40): Makefile flipped to cmd/cogos build - Phase 5 (#41): 25 dormant subcommands pruned from root With all migrations + prunes landed, the root serveServer is unreachable from any live code path: the installed binary has been cmd/cogos since Phase 4, the cogos-sandbox-mcp bridge consumes engine's ported /v1/bus/* routes, and hooks invoke engine's ported subcommands. Deleted, production (serveServer method receivers): - serve.go, serve_bus.go, serve_context.go, serve_context_build.go, serve_inference.go, serve_research.go, serve_messages.go, serve_providers.go, serve_dashboard.go, serve_daemon.go, serve_agents.go - bus_api.go, bus_stream.go - cogfield.go, cogfield_sessions.go, cogfield_documents.go, cogfield_buses.go, cogfield_adapters.go, cogfield_components.go, cogfield_conditions.go, cogfield_reconcile.go, cogfield_signals.go - modality_serve.go, modality_tools.go, modality_pipeline.go - agent_serve.go, agent_decompose.go, agent_observation.go - mcp.go, mcp_http.go, mcp_mod3.go - reconcile_serve.go - event_discord_bridge.go, events_webhook_config.go Deleted, tests whose fixtures lived in deleted production files: - foveated_test.go, serve_agents_test.go, serve_context_build_test.go, serve_messages_test.go, mcp_http_test.go, bus_stream_test.go, modality_pipeline_test.go, agent_user_turn_reply_test.go cog.go dispatch cleanup: - Dropped `case "serve":` and `case "mcp":` — both are engine-backed now - Removed `cog serve` help block Surviving-file trims: - decompose_test.go: removed two cycle-memory tests that exercised agent_decompose.go's ServeAgent-scoped helpers - agent_tools_respond_test.go: inlined capturedReply / sessionIDsOf / sameStringSet helpers that used to live in the deleted agent_user_turn_reply_test.go New consolidation files (replacing deleted-file type aliases the rest of the root package still relies on): - types_shared.go: CogBlock, BusEventData, busRegistryEntry, busSendRequest, busSendResponse, busEventEnvelope, defaultServePort, claudeCommand, codexCommand - openclaw_bridge.go: OpenClawBridge + MCPTool* types, lifted out of mcp.go because bus_tool_router.go and reconcile_mcp_tools.go still call into the bridge - bus_event_format.go: formatBusEvent + helpers, extracted from event_discord_bridge.go because bus_watch.go's line-format mode still calls into it Tally: 45 files deleted, 3 consolidation files added. 45 files changed, 652 insertions(+), 19,926 deletions(-). Net: ~19,274 LoC root-package contraction. Verification: - go build ./... clean - go vet ./... clean - go test ./... -short -race -count=1 green - cmd/cogos binary builds + serves /health, /v1/bus/send, /v1/bus/{id}/events with historical response shapes Closes the Agent I2 revised dead-code plan (Track 5).
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.
Phase 3 of the Track 5 migration plan (Agent I2).
What this lands
Additive-only
Root still serves these routes. Installed binary (per Makefile:44) remains root-backed until Phase 4 flips the build target. No user-visible change.
Shape verification
Captured live responses from cogos-v3 :6931 into /tmp/phase3-fixture-*.json, then ran the engine server through httptest and diff'd the top-level key sets:
Unblocks
Phase 4 Makefile cutover. After Phase 4 lands, running `cogos serve` from the installed binary will serve these routes via engine; rebuilding cogos-v3 will no longer break cog-sandbox-mcp bridge.
Not in scope
Test plan