Skip to content

fix(core): complete deepagent pipeline restructure downstream sync - #73

Merged
deepagent-ai merged 18 commits into
deepagent-ltd:devfrom
thomas-yanga:dev
Jul 17, 2026
Merged

fix(core): complete deepagent pipeline restructure downstream sync#73
deepagent-ai merged 18 commits into
deepagent-ltd:devfrom
thomas-yanga:dev

Conversation

@thomas-yanga

Copy link
Copy Markdown
Contributor

Summary

Completes the downstream sync left over from the deepagent context pipeline
restructure (f578e4f / eeeac7e), and fixes two regressions found while
verifying the Wave 2–5 CLI commands against a live daemon.

  • Drop orphaned oversight/webhook HTTP API modules whose service layers
    were removed by the restructure; the orphaned files broke typecheck and the
    CLI oversight command targeted endpoints that no longer exist.
  • Fix dacode run hanging after completion: the session event stream is now
    aborted on session.status idle, cancelling the underlying SSE fetch
    connection (the generated SSE client never cancels the fetch in its
    generator finally, leaking the socket and pinning the event loop).
  • Default missing apiKey in the provider discovery cache fetch wrapper.
  • Restore 6 V4 feature flags (v4PanelAutoConvene, v4AgentPushEnabled,
    v4EventDrivenIm, v4MultiAgentRuntime, v4EventDrivenArchive,
    v4Steering) still consumed by app capabilities and test RuntimeFlags
    overrides.
  • Complete the goal-driver API sync started in eeeac7e: inline the single-tick
    logic in goal-tick-port (pause/stop check + loop.tick + status publish),
    remove dead steer-relay wiring and dead maxFilesChanged /
    maxTokensPerHour gates, and delete/prune tests that targeted removed
    APIs (goal-steer, overflow, plan-status-cache, httpapi-webhook,
    plus pruned blocks in steer, multi-agent-runtime, model-discovery,
    goal-tick-cold-recovery).

Test plan

  • bun typecheck across the workspace: deepagent-code package 75 → 0 errors,
    turbo typecheck 15/15 green.
  • Manual CLI verification (Wave 2–5 commands): serve --register starts and
    registers cleanly; run exits normally (~36s, previously hung past 150s);
    debug agents, agent list, models, session list, packs list,
    service status all pass.
  • Affected tests (steer, goal-tick-cold-recovery, multi-agent-runtime,
    model-discovery): 41 pass / 4 fail — the 4 failures are pre-existing
    runtime-behavior leftovers from the restructure (baseline was 8 failures on
    the same files), unrelated to typecheck errors and noted for follow-up.

Add nix/scripts/update-hashes.py and Platform: x86_64-linux
Building node_modules_updater to compute correct hash ...
Correct hash: sha256-2cnaDO1erE8kXD6iZtzAqd0hoLLl3IV1hwqXI9yoUhw=
Updated x86_64-linux: sha256-2cnaDO1erE8kXD6iZtzAqd0hoLLl3IV1hwqXI9yoUhw= → sha256-2cnaDO1erE8kXD6iZtzAqd0hoLLl3IV1hwqXI9yoUhw=

Done. You can now run: nix build .#deepagent-code app
that builds node_modules_updater with fakeHash and extracts the
correct hash automatically.  No more manual hashes.json editing.

The upstream nix-hashes CI already computes hashes for all 4
platforms; this adds local tooling for fork users and non-CI
environments.
Wave 0 of CLI↔GUI parity plan. Replace the v2 half-surface
(createRoutes from @deepagent-code/server) with the complete
legacy server (Server.listen from deepagent-code/server/server),
which is the only surface with a full session lifecycle — matching
the GUI and the old 'deepagent serve'.

- Add deepagent-code workspace dependency to cli package
- Rewrite serve handler to call legacy Server.listen with mDNS/CORS
  flags; inject password via DEEPAGENT_CODE_SERVER_PASSWORD env
  (legacy auth reads env, not a listen argument)
- Add session-client.ts migration seam centralizing session-execution
  calls for the future durable-engine swap
- Add @/* path mapping and *.wasm ambient declaration so the
  deepagent-code source graph resolves during cli typecheck

Verified: tsgo --noEmit passes, oxlint clean, serve responds on
/api/health, /session, /provider, /mcp, /global/capabilities,
/deepagent/packs/all (all HTTP 200); unauthenticated returns 401.
Wave 1 of CLI↔GUI parity plan. The default command (TUI) now accepts
-c/--continue, -s/--session, --fork, -m/--model, --agent, --prompt
and a project positional argument, matching the old 'deepagent' CLI.

- commands.ts: add params to root command with Flag.withAlias for
  short names (-c, -s, -m)
- default.ts: assemble parsed flags into Args, resolve project to
  working directory, validate --fork requires --continue/--session,
  verify session existence via daemon client before entering TUI
- tui.ts: runTui accepts args and directory, replacing hardcoded {}
- daemon.ts: increase health-check retry from 5s to 60s to accommodate
  legacy server startup time (full core initialization)

Verified: --help shows all flags with aliases, --fork without
--continue/--session errors, invalid session ID reports 'Session not
found', daemon auto-starts with legacy server.
Add 7 daemon-client commands for CLI↔GUI parity:

- session list: SessionClient.list with table/JSON output and less paging
- session delete <id>: SessionClient.deleteSession with NotFound handling
- models [provider]: client.provider.list with --verbose JSON output
- run [message..]: subscribe events → promptAsync → event loop to idle,
  supports --model/--agent/--format json/--continue/--session/--fork/
  --variant/--dangerously-skip-permissions
- export [sessionID]: SessionClient.get + messages reconstruction,
  --sanitize redacts sensitive transcript data
- stats: aggregates cost/tokens from session list, table/JSON output
- import <file>: /global/import endpoint (Codex/Claude format) with
  SSE progress stream consumption

All commands follow dual-channel output contract (human-read TTY +
machine-read --format json), use SessionClient migration seam for
session execution calls, and pass typecheck + lint.
- auth login/list/logout: provider credentials via client.auth.set/remove
- agent list: list agents via client.app.agents()
- mcp list: MCP server status via client.mcp.status()
- mcp add: persist MCP config via client.global.config.update()
- All commands use daemon client (A mode) for consistency with Wave 0-2
Add 7 command groups for DeepAgent self-developed features:
- packs list/pin/unpin (client.deepagent.packs*)
- wiki list/get/search (raw HTTP, flag-gated: wiki)
- oversight metrics/queue/approve/reject/ack/trace (raw HTTP)
- review pending/approve/reject (client.deepagent.knowledge.*)
- env-facts list/decide (client.deepagent.envFacts.*)
- goal start/status/pause/resume/stop (raw HTTP, flag-gated: goalLoop)
- panel status (raw HTTP, flag-gated: expertPanel)

All commands use daemon client (mode A). Flag-gated commands
check /global/capabilities and fail-close with a clear message
when the feature is not enabled. Shared util.ts provides capability
gating and raw HTTP escape hatch (client.client.request).
- attach: TUI connects to remote server with auth headers
- db: database tools (path + SQL query with json/tsv output)
- web: start full server + open browser
- upgrade: self-update via Installation module
- uninstall: remove files/config with dry-run and keep flags
- pr: fetch PR branch via gh CLI then launch TUI
- acp: ACP stdio server via @agentclientprotocol/sdk
- github: delegate to deepagent-code binary for install/run
- Add @agentclientprotocol/sdk and drizzle-orm dependencies
Repair over-deletions from f578e4f that left kept consumers unloadable,
and continue its test cleanup:

- migration.gen.ts: register 16 V4 migration files that existed on disk
  but were never wired into the registry (fresh DBs missed
  deepagent_workspace_config, session_steer, event bus, etc.)
- session/sql.ts: restore SessionSteerTable (steer.ts service + V2
  session-core steering still depend on it)
- goal-loop.ts: restore readGoalTickCursor (goal-tick cold-recovery
  chain still consumes it; persistState keeps writing its format)
- code-indexer.ts: restore symbolsForFilePaths (v4-event-runtime
  conflict-arbiter feed)
- goal-manager.ts: restore goalStoreRoot export (v4-event-runtime
  imports it)
- goal-loop-wiring.ts: restore SubagentTurnInput workspaceID/directory/
  correlationID/maxTurnDurationMs (event turn runner still reads them)
- goal-tick-port.ts: drop pendingPlanEdit/markPlanEditConsumed ports
  (API removed from core goal-loop + GoalDriverPorts)
- delete obsolete prompt-cache-stability tests (volatile-tail design
  abandoned by the restructure) and stale world-state/im/wiki tests
- builtin-agents.ts: drop removed maxFilesChanged limit values

Remaining known desync (in progress): v4 flag reads in event-dispatcher,
v4-event-runtime, session-completed-publisher, agent-push,
supervisor-notifier, panel-convene-consumer; goal-driver API rework
sync in goal-tick-port + goal-steer/steer tests; oversight/webhook
httpapi registry; ~135 typecheck errors in packages/deepagent-code.
Their registrations were already removed from api.ts and server.ts in
f578e4f; the group/handler files and the CLI oversight command (which
called the removed /oversight/* endpoints) were dead code.
The generated SSE client's generator finally only releases the reader
lock; the underlying fetch connection is never cancelled, leaking a
socket that keeps the event loop alive. Pass an AbortController to
event.subscribe and abort before breaking out of the consume loop.
discoverProviderModels requires apiKey: string; the cached wrapper's
input has it optional. Default to empty string instead of passing
undefined.
Definitions for v4PanelAutoConvene, v4AgentPushEnabled, v4EventDrivenIm,
v4MultiAgentRuntime, v4EventDrivenArchive and v4Steering, read by the
app IM capabilities and exercised by session/panel/server tests.
Adapt the remaining desynced consumers to the restructured goal driver:

- goal-tick-port: inline the single-tick body (pause/stop checks + one
  loop.tick + status publish); the goal-steer relay (makeGoalSteerRelay,
  GOAL_STEER_DELIVERY, pendingSteer/markSteerConsumed ports) was removed
  from goal-driver/goal-loop-wiring/core goal-loop, so drop its wiring
  here and in v4-event-runtime (steerBuffer no longer needed).
- multi-agent-runtime: drop the §C1 maxFilesChanged and §E2
  maxTokensPerHour gates plus the token-budget tracker — both limit
  fields were removed from the agent limits schema, making the gates
  dead code.
- Delete test files pinning removed APIs: goal-steer (steer relay),
  overflow (soft-landing state machine), plan-status-cache (volatile-tail
  cache design abandoned by the restructure), httpapi-webhook (webhook
  API dropped in 1db089f); trim removed-API cases from steer,
  multi-agent-runtime and model-discovery tests; adapt
  goal-tick-cold-recovery to the single-tick port.

typecheck in packages/deepagent-code goes from 75 errors to 0. Four
runtime test failures in steer/multi-agent-runtime predate this change
(baseline: 8 failures on the same two files) and remain as restructure
follow-up.
@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

Take upstream v4.0.3 semantics in the 6 conflicted files (plan-gate
warn-only downgrade, PlanStore authority, V4.1 dual-path resume,
sessions.clear, consecutive_blocks backfill, app version 1.4.2).
@deepagent-ai
deepagent-ai merged commit abb6a71 into deepagent-ltd:dev Jul 17, 2026
3 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants