Skip to content

v1.4.3#86

Merged
deepagent-ai merged 5 commits into
mainfrom
dev
Jul 23, 2026
Merged

v1.4.3#86
deepagent-ai merged 5 commits into
mainfrom
dev

Conversation

@deepagent-ai

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

deepagent-ai and others added 5 commits July 21, 2026 01:22
**根因定位**
- `deepagent-code.db` 704MB,其中 `event` 表独占 559MB(75K 行 EventV2
  mirror 事件,无任何清理机制,只增不减)
- `sessions.json` 2.6MB,每次状态变更(28 处调用点)同步全量写入(含 fsync)
  + pretty-print 额外 25% 体积;单个 session `userRequest` 字段高达 837KB
- `import-snapshot.db` 1GB 一次性导入快照(已单独手动删除)

**Fix 1 — sessions.json(packages/core/src/deepagent/session-state.ts)**
- 去掉 `JSON.stringify(data, null, 2)` 的 pretty-print,改用紧凑 JSON
- saveToDisk 改为防抖模式:多次连续调用只触发一次 `setImmediate` 写入,
  不再每次 streaming delta 都阻塞 event loop 做 fsync
- `userRequest` 字段超过 10KB 时在序列化前截断,防止单个大粘贴
  把整个 sessions.json 膨胀数百 KB

**Fix 2 — EventV2 retention(packages/core/src/deepagent/retention-sweeper.ts)**
- 原有 RetentionSweeper 只清理 `deepagent_event`(DeepAgentEventBus),
  不碰 `event`/`event_sequence`(EventV2 mirror),导致无限增长
- 在 sweepOnce 里为每个 workspace 增加一步:查找 `session` 表中
  `time_archived IS NOT NULL AND time_archived < olderThan` 的会话,
  DELETE 其 `event_sequence` 行(CASCADE 自动清掉对应 `event` 行)
- 引用安全:只 prune 已存档且超过 retentionDays(默认30天)的会话,
  活跃会话的 event 日志完全不动
- SweepSummary 新增 `deletedEventV2Sequences` 字段用于可观测性

**测试(test/retention-sweeper.test.ts)**
- 新增3个 §EventV2-retention 测试:
  prune 超期已存档会话事件 / 保留最近存档 / 保留未存档活跃会话
- 全部 11 个 sweeper 测试通过,turbo typecheck 15/15 全绿

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
**问题**
1. OpenAI gpt-5.6-sol 等新模型在走 @ai-sdk/openai-compatible 路径时只显示
   low/medium/high(无 xhigh),而 Codex 等 @ai-sdk/openai 路径可以正确显示。
2. Anthropic Fable 5 等新模型不在 anthropicAdaptiveEfforts() 的识别列表里,
   导致退回旧的 budgetTokens 模式,只有 high/max 两档。

**根因**
- Bug #1 (@ai-sdk/openai-compatible):variants() 里该 case 直接硬写
  WIDELY_SUPPORTED_EFFORTS,从不调 openaiCompatibleReasoningEfforts(),
  所以无论 api.id 是多新的 gpt-5.x,都只给 low/medium/high。
  @ai-sdk/openai(直连)和 @ai-sdk/gateway 路径调用了正确的函数,所以表现一致。
- Bug #2 (Fable 5):anthropicAdaptiveEfforts()/anthropicOpus47OrLater() 只匹配
  "opus-X.Y" 和 "sonnet-4.6" 模式,"fable-5" 不含任何上述关键词 → 返回 null
  → 走旧 { high: {budgetTokens:16000}, max: {budgetTokens:31999} }。

**修复**
- Bug #1:@ai-sdk/openai-compatible case 里对 GPT-5 family (GPT5_FAMILY_RE) 的模型
  调用 openaiCompatibleReasoningEfforts(),非 GPT-5 模型维持原有 low/medium/high。
- Bug #2:新增 anthropicFable5OrLater() 函数(匹配 "fable-5/fable.5" 等格式,
  版本号≥5 即生效),更新 anthropicAdaptiveEfforts() 和 adaptiveOpus 同时识别 Fable 5+。
  Fable 5 获得 ["low","medium","high","xhigh","max"] 和 display:"summarized"(与 Opus 4.7+ 一致)。

**测试**
- 新增:openai-compatible gpt-5.6-sol 返回 xhigh / 非 gpt-5 仍只有 low/medium/high
- 新增:fable-5 / claude-fable-5-20260720 返回 xhigh 含 display:summarized
- 260/261 通过(唯一失败是预存在的 azure 测试,与本次改动无关)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
### Issue for this PR

Closes #

### Type of change

- [ ] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [ ] Documentation

### What does this PR do?

Please provide a description of the issue, the changes you made to fix
it, and why they work. It is expected that you understand why your
changes work and if you do not understand why at least say as much so a
maintainer knows how much to value the PR.

**If you paste a large clearly AI generated description here your PR may
be IGNORED or CLOSED!**

### How did you verify your code works?

### Screenshots / recordings

_If this is a UI change, please include a screenshot or recording._

### Checklist

- [ ] I have tested my changes locally
- [ ] I have not included unrelated changes in this PR

_If you do not follow this template your PR will be automatically
rejected._

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…nds, remote transport, headless entry hardening (#81)

### Issue for this PR

Closes #

### Type of change

- [ ] Bug fix
- [x] New feature
- [ ] Refactor / code improvement
- [ ] Documentation

### What does this PR do?

This PR prepares the new CLI (`packages/cli`, `dacode`) and the headless
server to act as a client/data-plane for DeepAgent Server Edition
(design: server-v1 §11/§13/§20). The CLI now connects to a gateway with
JWT auth and routes workspace traffic through the `/w/:workspaceId`
transparent proxy instead of a local daemon.

**CLI changes:**
- `dacode login [gateway] [--email --password]` / `logout` –
authenticate via `POST /control/v1/auth/login`, store state in
`~/.deepagent/code/state/server-mode.json` (0600, atomic temp+rename).
Flags optional; fallback to interactive prompts. Refresh token read from
response body, with `Set-Cookie` as fallback.
- `dacode workspace list` / `dacode workspace use <id>` – list gateway
workspaces and pin a selection; remote base URL becomes
`{gateway}/w/{workspaceId}`.
- The `Connection` service switches to remote transport when server-mode
is active; otherwise uses the existing local daemon (unchanged
behavior).
- Remote transport is a fetch wrapper that injects `Authorization:
Bearer` and, on 401, performs a single-flight token refresh with one
retry. Since the TUI already accepts a custom `fetch`, all TUI/SDK
traffic (including SSE) gets auth + reconnect without any changes to
`packages/tui`.
- `DEEPAGENT_GATEWAY_URL` pins the gateway (server-v1 §20.3
auto-switch); a mismatch with stored login produces a clear error
suggesting `dacode login <url>`.

**Server changes (`packages/deepagent-code`):**
- Add explicit `"./server"` subpath export so `import { listen, openapi
} from "deepagent-code/server"` resolves as documented for the
workspace-agent.
- `/global/capabilities` gains an optional `commit` field from
`DEEPAGENT_CODE_COMMIT` (injected by CI for version-checking, §13.3).
Omitted in local builds; optional in schema for backward compatibility.
- `DEEPAGENT_SERVER_MODE=true` makes `Auth.set`/`Auth.remove` fail with
a clear error – in gateway-managed containers, provider keys come via
env and must not persist to volume (§20.4). Reads (including
`DEEPAGENT_CODE_AUTH_CONTENT`) are unaffected.

> **Note:** The gateway itself (`deepagent-code-server` repo) is not
implemented yet; the refresh-cookie contract may need a follow-up once
the real gateway exists.

### How did you verify your code works?

- `bun typecheck` passes for `packages/cli`, `packages/core`,
`packages/deepagent-code`.
- End-to-end against a mock gateway (`Bun.serve` implementing auth
endpoints, workspace listing, and proxy paths): covered login via
args/env, state file permissions, workspace list/use with expired token
refresh, remote transport URL and auth injection, logout, and gateway
mismatch errors.
- Server tests: started the legacy server via the new subpath export,
confirmed `/global/capabilities` returns the injected commit and
`openapi()` works; `Auth.set`/`Auth.remove` are blocked under
`DEEPAGENT_SERVER_MODE=true`; without it `auth.json` is written with
mode 600.
- Existing related suites pass: `test/auth/auth.test.ts`,
`test/server/httpapi-global.test.ts`,
`test/server/httpapi-public-openapi.test.ts`.
(`test/server/httpapi-listen.test.ts` has PTY failures that reproduce
identically on the base commit in this environment.)

### Screenshots / recordings

_No UI changes._

### Checklist

- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR

---------

Co-authored-by: deepagent-ai <jamessmithm539@gmail.com>
#85)

… task pagination and interruption UI

Audit P1/P2 fixes from review:
- V4 durable consumer group register/unregister lifecycle with cleanup
on flag change
- task interrupted state recognized in UI (state:interrupted + legacy
boolean compat)
- task_read cursor pushed to MessageV2.page for proper pagination beyond
101 messages
- server-aware tab restore persists active tab key, not store[0]
ordering
- busy steer preserves all prompt parts (file/image/agent) with
server-minted canonical ID
- steer correlationID idempotency: same payload returns stored row,
different payload returns 409
- terminal host close routing: side panel closes rightPanel not bottom
dock
- terminal lifecycle race: closeRequest gates before auto-create to
prevent restart

### Issue for this PR

Closes #

### Type of change

- [ ] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [ ] Documentation

### What does this PR do?

Please provide a description of the issue, the changes you made to fix
it, and why they work. It is expected that you understand why your
changes work and if you do not understand why at least say as much so a
maintainer knows how much to value the PR.

**If you paste a large clearly AI generated description here your PR may
be IGNORED or CLOSED!**

### How did you verify your code works?

### Screenshots / recordings

_If this is a UI change, please include a screenshot or recording._

### Checklist

- [ ] I have tested my changes locally
- [ ] I have not included unrelated changes in this PR

_If you do not follow this template your PR will be automatically
rejected._

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@deepagent-ai
deepagent-ai merged commit 019c91d into main Jul 23, 2026
5 of 16 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