Skip to content

feat(mobile): support viewing workflow runs and history (#2032) - #2037

Merged
NanmiCoder merged 3 commits into
mainfrom
feat/mobile-workflow-runs
Nov 26, 2026
Merged

NanmiCoder merged 3 commits into
mainfrom
feat/mobile-workflow-runs

Conversation

@NanmiCoder

Copy link
Copy Markdown
Owner

Summary

Closes #2032.

Adds mobile support for inspecting live Workflow runs and reviewing finished Workflow history:

  • Server read-only access & projection:
    • Allow read-only GET /api/workflows/session-runs/:sessionId, GET /api/workflows/runs, and GET /api/workflows/runs/:sessionId/:runId in src/server/publicAccess.ts while keeping /api/workflows/:name and all write operations desktop-only.
    • Project remote /api/workflows/runs and /api/workflows/runs/:sessionId/:runId with explicit allowlists in src/server/remoteBrowserPolicy.ts so desktop scriptPath, script, logs, and unknown desktop-only fields stay on the desktop.
    • Preserve taskType: 'local_workflow' for finished workflow notifications in src/server/services/sessionBackgroundActivity.ts.
  • Mobile Workflow live activity & subagent reuse:
    • Track live Workflow WebSocket system_notification events (task_started / task_progress / task_notification), reconcile stale running runs on reconnect / terminal server updates, and combine with GET /api/workflows/session-runs/:sessionId.
    • Add the 工作流 section to ActivitySheet (grouped by phase heading + settled count, with agent rows for 运行中 / 已完成 / 失败 / 跳过 / 待开始, no per-workflow stop action).
    • Route workflow agent taps through agent:<agentId> to /api/sessions/:id/subagents/by-agent/:agentId, reusing the existing SubagentRun detail screen.
    • Exclude local_workflow from 「后台命令」 and stopTask/stopAll, and keep the main composer Stop button active while a background workflow continues after its launch turn ends.
  • Mobile Workflow history:
    • Add Workflow 记录 beside 运行中 in the session action menu, listing finished runs (name, status, start/end time & duration, phase count) with a phase-list detail view and retryable detail fallback.

Feature Quality Contract

  • Changed surface: mobile, server
  • Tests added or updated:
    • Server unit/allowlist/projection tests: src/server/publicAccess.test.ts, src/server/services/sessionBackgroundActivity.test.ts
    • Mobile unit & wiring tests: mobile/src/core/workflows.test.ts, mobile/src/ui/activity/workflowHistoryView.test.ts, mobile/src/core/operations.test.ts, mobile/src/core/sessionActivityModel.test.ts, mobile/src/ui/activity/subagentView.test.ts, mobile/src/ui/team/teamPlanWiring.test.ts, plus chat wiring sheet mocks
  • Coverage evidence:
    • Verified 100% line coverage on changed server lines (publicAccess.ts, remoteBrowserPolicy.ts, sessionBackgroundActivity.ts) via bun test --coverage src/server/publicAccess.test.ts src/server/services/sessionBackgroundActivity.test.ts (81/81 pass on integrated HEAD).
    • Full PR CI checks will run on GitHub Actions.
  • E2E / live-model evidence:
    • Deterministic agent-e2e (34 mock-llm + 21 replay), chat-contract, agent-flow, server, policy, and mobile checks run without live models; live-model smoke not run.
  • Known risk / rollback:
    • Low risk: read-only workflow endpoints and additive mobile views. Revert cleanly by reverting this PR commit.

Verification

  • I ran the relevant local checks, or explained why they do not apply.
  • I added or updated same-area tests for every production behavior change.
  • I ran the checks selected by bun run check:impact; if I claim PR-ready/full validation, I also ran bun run verify.
  • New or changed executable production lines meet the changed-line coverage threshold, or the blocker/maintainer override is documented.
  • I attached or summarized the quality report path, JUnit/log artifact path, and pass/fail/skip counts.
  • I ran deterministic E2E/contract checks for cross-boundary changes. Live-model evidence is attached when a trusted maintainer ran it, otherwise it is explicitly marked not run.

Risk

  • This PR does not touch CLI core paths, is authored by a CODEOWNER, or has maintainer approval for allow-cli-core-change.
  • Production code changes include matching tests, or have maintainer approval for allow-missing-tests.
  • Coverage baseline/threshold changes have maintainer approval for allow-coverage-baseline-change.
  • Any quarantine-policy change has maintainer approval; deterministic provider/chat contract tests were not quarantined.
  • Provider/runtime changes are covered by offline mock/fixture contract tests; live smoke was run by a trusted maintainer or explicitly deferred.

@github-actions

Copy link
Copy Markdown

PR quality triage

Changed areas: area:server

CLI core policy: No CLI-core policy block detected.

Missing-test policy: No missing-test policy block detected.

Coverage baseline policy: No coverage-baseline policy block detected.

CLI core files:

  • none

Coverage policy files:

  • none

Required check plan:

  • See PR Quality / scope-plan; it is the single source of truth for selected jobs.

Test coverage signals:

  • No obvious missing-test signal from changed paths.

Risk notes:

  • No special risk notes from changed paths.

Hard merge gates come from the deterministic GitHub Actions contract lanes above.

@NanmiCoder
NanmiCoder merged commit 26eb580 into main Nov 26, 2026
19 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.

[功能] 手机端支持查看 Workflow 运行与历史记录

1 participant