Commit Graph

216 Commits

Author SHA1 Message Date
Codex 32b29bc1dc fix: reensure AgentRun runner for reused sessions 2026-06-03 23:21:05 +08:00
Codex 8f0a2cd213 fix: align v0.2 explicit agent session dispatch
Fixes HWLAB #782.
2026-06-03 22:50:58 +08:00
Codex eb5bada0d1 fix(v0.2): device-pod output.text evidence read-only selectors for #773
Tracks pikasTech/HWLAB#773. PR #765 fixed selector confusion but did
not touch cloud-api evidence propagation. This change closes the
real root cause and adds the read-only evidence selectors that #760
follow-up called for.

cloud-api (internal/cloud/access-control.ts):
- DEVICE_JOB_INTENTS adds workspace.evidence and debug.evidence.
- DEVICE_JOB_READ_ONLY_SUB_ACTIONS = { status, output, wait, cancel,
  evidence } and DEVICE_JOB_ACTIONABLE_INTENTS = { workspace.build,
  debug.download } make the mutating-intent / sub-action matrix
  explicit.
- _deviceJobRequiresReason(intent, args, reason) returns false when
  the caller already provided reason OR when the actionable mutating
  intent is paired with a read-only sub-action. debug.reset and other
  non-actionable mutating intents still always require reason.
- executorOutputPayload now also surfaces output.summary,
  nestedOutput.summary, evidence.text, evidence.logTail and
  evidence.summary as body.output.text, so a dispatcher that
  includes the host logTail / buildSummary in its result becomes
  visible to the Code Agent without a separate bootsharp dance.

device-pod executor (cmd/hwlab-device-pod/main.ts):
- gatewayDispatchText also walks result.evidence.{text,logTail,
  summary}, dispatch.message (only when dispatchStatus=completed),
  dispatch.summary, result.summary and dispatch.buildSummary before
  falling back to JSON.stringify.
- deviceHostArgs maps workspace.evidence / debug.evidence to the
  host device-host-cli evidence subcommands.

device-host-cli (skills/device-pod-cli/assets/device-host-cli.mjs):
- new readJobEvidence(kindPrefix, requestedId, { tail, full,
  target }) reads the most recent (or specified) keil-build /
  keil-download job log file and returns it as keil-build.evidence /
  keil-download.evidence. tail defaults to 200, --full for entire
  log. Missing job returns ok=false but does not throw.
- workspace build evidence and debug-probe download evidence now
  wired in main() and help text.

device-pod-cli (tools/src/device-pod-cli-lib.ts):
- selectorCheatSheet adds the evidence row and clarifies that
  build/download status/output/wait/cancel/evidence are read-only
  and do NOT need --reason. build/download start still require
  --reason. usage examples now include the two evidence selectors.
- failed-fast selectors are unchanged; existing 26 tests still pass.

SKILL.md (skills/device-pod-cli/SKILL.md):
- Selector Cheat Sheet adds workspace.evidence and
  debug.evidence rows.
- #773 follow-up note: --reason is now required only for
  mutating sub-actions, not for the read-only ones.

cloud-api tests (internal/cloud/access-control.test.ts):
- workspace.evidence and debug.evidence must be in DEVICE_JOB_INTENTS.
- _deviceJobRequiresReason signature and the read-only / actionable
  branch table.
- executorOutputPayload must look at evidence and summary fields
  in addition to text. 3 new tests; pre-existing 4 workbench
  failures are unrelated to this change and reproduce on the
  unchanged v0.2 base.

Verification (host-side, G14 /root/hwlab-v02, source=0cf9a8c6):
- bun test tools/device-pod-cli.test.ts → 26/26 pass.
- bun test internal/cloud/access-control.test.ts → 23 pass,
  4 pre-existing workbench failures (unchanged on v0.2 base).
- bun test cmd/hwlab-device-pod/main.test.ts → 7/7 pass.
- node --check skills/device-pod-cli/assets/device-host-cli.mjs
  → syntax OK.

Hot probe: live v0.2 cloud-api at 74.48.78.17:19667 confirmed
job_devicepod_804c5db4... (workspace.build) returned
text="", bytes=0, output={} before this change. After the
executor text-extraction update and the new evidence selector,
a follow-up workspace.build start + build evidence will surface
the host logTail / buildSummary in body.output.text without
requiring bootsharp + host file fallback.

Tracked-by: pikasTech/HWLAB#773
2026-06-03 21:57:39 +08:00
Codex 6341015d3b feat(v0.2): Code Agent 默认 sessionStorage=persistent + eviction reset UX
PR D for #770:HWLAB Cloud Web Workbench 透传 session state 真正持久化

- code-agent-agentrun-adapter.ts:
  * 新 ensureAgentRunSessionPersistent:默认 sessionStorage=persistent,
    调 POST /api/v1/sessions 同步建 session + PVC
  * submitAgentRunChatTurn 改两步尝试:ensureSession 或 runner-jobs POST
    收到 session-store-evicted 时用新 sessionId(<base>-reset-<trace8>)
    + threadId=null 重试,trace 追加 agentrun:session-reset 事件
  * 新 shouldResetSessionAfterEviction / newSessionIdAfterEviction 辅助函数
- code-agent-response-contract.mjs: session-store-evicted 归
  session-blocked category
- code-agent-chat.ts: 新 userMessage
  「Code Agent session 存储已失效(PVC 被回收或 TTL 到期),
   HWLAB 已为你开新 sessionId,可继续发送下一条消息。」
- spec-v02-hwlab-cloud-web.md: 新增 'Session state 持久化与 eviction reset'
  章节,含禁止路径与实现情况表

env 控制:HWLAB_CODE_AGENT_AGENTRUN_SESSION_STORAGE=ephemeral
可退回 metadata-only 模式(PR 前默认行为)。
2026-06-03 21:47:14 +08:00
Codex 6dbc72deac fix(issue740): HWLAB v0.2 WEBUI session management improvements
1. 在 panel-title-row 增加"复制 session id"按钮,把当前会话
   conversation id 复制到剪贴板,便于在 HWLAB CLI 复现;
2. 侧边栏标签改为显示最近更新时间(相对时间),排序仍然按
   lastTimestampMs 倒序,新会话靠前;
3. messageCount 与 firstUserMessagePreview 由 backend 持久化,
   不再被 slice(-50) 窗口掩盖,CLI/Web 看到的条数一致;
4. 把 left-sidebar-resize 移到 session-sidebar 右侧,
   activity-rail 固定 92px,拖拽控制 session-sidebar 宽度;
5. 侧边栏标签默认显示用户摘要(首条 user message 截断),
   长文本用省略号收尾。

新增 `hwlab-cli client session inspect <conversationId>` 子命令
与 `GET /v1/agent/conversations/{id}` 端点对齐,便于在 CLI 复现
WEB 看到的 session 详情(包含 messageCount / trace / thread)。

Backend 改动:access-control.ts 的 normalizeConversationSnapshot
和 mergeAgentSessionOwnerEvidence 现在按 max 累加 messageCount,
并保留 firstUserMessagePreview;mergeTerminalConversationMessages
返回 { messages, messageCount, firstUserMessagePreview }。
2026-06-03 11:41:02 +08:00
Codex 94b9df822c feat: 手动化 Code Agent session 管理 2026-06-03 10:40:50 +08:00
Codex da25cb4c02 feat: align session sidebar and cli management 2026-06-03 09:47:52 +08:00
Codex 90c5dad065 feat: show prompt assembly in skills panel 2026-06-03 08:03:04 +08:00
Codex e2d4989468 fix: expose AgentRun skill assembly in v02 web 2026-06-03 07:02:09 +08:00
Codex 0d4f5ef098 fix: preserve code agent sessions after turn failures 2026-06-03 00:28:40 +08:00
Codex 9f287fa0d9 fix: allow code agent workspace concurrency 2026-06-02 21:54:28 +08:00
Codex 93b53e7d56 fix: expose AgentRun prompt assembly trace details 2026-06-02 21:11:27 +08:00
Codex 58df53bce5 feat: assemble AgentRun prompts and skills 2026-06-02 20:56:36 +08:00
Codex 39562d9c02 fix: clear stale continuation after thread resume failure 2026-06-02 20:12:01 +08:00
Codex 60a15186e5 fix: assemble unidesk ssh for web agentrun turns 2026-06-02 19:02:58 +08:00
Codex 7f97b41404 fix: route hwpod through cloud-api 2026-06-02 18:48:56 +08:00
Codex bacfa24289 fix: replace device pod lease with api key 2026-06-02 18:11:32 +08:00
Codex 29e9e23fb3 fix: use native codex stdio continuation 2026-06-02 16:22:27 +08:00
Codex 11dc7df502 fix: surface nested devicepod executor output 2026-06-02 15:03:41 +08:00
Codex 12560c9e91 Merge remote-tracking branch 'origin/v0.2' into fix/v02-context-completed-693 2026-06-02 12:37:41 +08:00
Codex e88951dadc fix: preserve AgentRun completed turn context 2026-06-02 12:34:55 +08:00
Lyon f9a63afeea Merge pull request #696 from pikasTech/fix/v02-agentrun-toolcall-trace-render
fix: preserve AgentRun command tool calls in trace
2026-06-02 12:17:32 +08:00
Codex fcfc7e84e5 fix: preserve AgentRun command tool calls in trace 2026-06-02 12:15:21 +08:00
Codex 7e39d993a8 Merge remote-tracking branch 'origin/v0.2' into fix/v02-workbench-orphan-active-trace 2026-06-02 12:14:55 +08:00
Codex 36e4ba2068 Merge remote-tracking branch 'origin/v0.2' into fix/v02-workbench-orphan-active-trace
# Conflicts:
#	docs/reference/spec-v02-hwlab-cloud-api.md
#	internal/cloud/access-control.test.ts
#	internal/cloud/server-agent-chat.test.ts
2026-06-02 12:13:50 +08:00
Codex 47c4ce2d97 fix: 明确 AgentRun tool-call 错误归因 2026-06-02 12:08:38 +08:00
Codex 2477190ae2 fix: unify device-pod runner entry 2026-06-02 10:40:03 +08:00
Codex 3497a8993b feat: support agentrun steer and idle continuation 2026-06-02 10:29:46 +08:00
Codex 3c6edb73a1 fix: 统一 AgentRun threadId 上下文连续性 2026-06-02 10:19:34 +08:00
Lyon da73598d60 fix: scope agentrun sessions by backend profile (#683)
Co-authored-by: Codex <codex@local>
2026-06-02 09:15:46 +08:00
Codex adb5930d59 fix: assemble hwpod alias for agentrun 2026-06-02 08:57:03 +08:00
Codex 48492ba267 fix: 释放孤儿 active trace 2026-06-02 08:55:10 +08:00
Codex f52eadfbe7 feat: route minimax m3 through agentrun 2026-06-02 08:50:27 +08:00
Codex 666395f056 fix: ignore stale workbench active trace 2026-06-02 08:35:12 +08:00
Codex bc0a9f9d16 fix: keep agentrun transient env within schema 2026-06-02 08:19:03 +08:00
Codex 399af47ee8 fix: assemble device pod runtime endpoint 2026-06-02 07:44:24 +08:00
Lyon f0ddb634d8 fix: consume AgentRun assistant authority (#673)
Co-authored-by: Codex <codex@local>
2026-06-02 07:19:52 +08:00
Codex da96f02333 fix: preserve AgentRun reuse mapping and trace rendering 2026-06-02 03:16:50 +08:00
Codex 66ffd2e171 fix: repair stale terminal workbench conversations 2026-06-02 02:45:00 +08:00
Codex bf2bdee5f6 fix: sync terminal workbench conversation 2026-06-02 02:25:29 +08:00
Codex ca4f14b421 fix: collapse AgentRun reuse trace noise 2026-06-02 02:00:29 +08:00
Codex 577622d0ab fix: sync terminal workbench traces 2026-06-02 01:55:19 +08:00
Codex 90f030e8f7 fix: release completed agentrun workspace turns 2026-06-02 00:50:20 +08:00
Codex 936884bdc1 fix: reduce AgentRun trace noise for HWLAB CLI 2026-06-02 00:48:38 +08:00
Codex 3b504cdf13 fix: restore web trace context for CLI replay 2026-06-02 00:34:21 +08:00
Lyon 5dc263e10a fix: align AgentRun trace rendering (#665)
Co-authored-by: Codex <codex@local>
2026-06-01 23:58:06 +08:00
Lyon 24060853e7 fix: reuse AgentRun runner for HWLAB turns (#662)
Co-authored-by: Codex <codex@local>
2026-06-01 23:18:40 +08:00
Codex 99aeb99991 fix(workbench): bind postgres workspace created timestamp 2026-06-01 22:00:16 +08:00
Codex 4691780b7a fix(workbench): type postgres workspace update role parameter 2026-06-01 21:54:02 +08:00
Codex b7285b30b1 feat(workbench): share account workspace across web and cli 2026-06-01 21:31:26 +08:00