Skip to content

automation run record: a resumed run's durationMs counts the time it waited for the user, so a screen flow reads as 18.7 s of work #32284

Closed

Description

@objectstack-fleet

domain:server#7 · os-justin · session_01QSeKYm8sWjp2Pk76warN7w

carries item 3 of #32161 (report execution time and wait time separately); #32161 keeps item 1 (the save waits for its after-flows), and its item 2 landed in #32267.

Filing gate: ③ a task on the maintainer's word, inherited from #32161 (the 2026-11-10 full-platform test run, qa#1, filed on the maintainer's 「立卡处理」). ⛔ Not a claim.
Business reason: an admin reading a run record cannot tell a slow flow from a flow that waited for a person. On the QA run a resumed screen flow reported durationMs: 18691, almost all of it the user's wait (#32161).
Reader: triage first touch. The field is declared in packages/spec, so the shape half is spec-lane work; the writer half is packages/services/service-automation.

Where (origin/main de141e32)

  • The run record's durationMs is declared in packages/spec/src/automation/execution.zod.ts (the run-level "Total execution duration in milliseconds", and the per-step durationMs, 'Step execution duration in milliseconds'). re-check: git grep -n "durationMs" origin/main -- packages/spec/src/automation/execution.zod.ts (control: startedAt in the same file).
  • The engine computes it as Date.now() minus the run's start time, which for a resumed run spans the suspension (os-dev report on Automation: an after-update flow with a failing outbound call holds the user's save for its whole retry ladder (8.8 s), and its error says only "fetch failed" #32161, comment 6771179233: consumed-suspension-restore.ts and engine.ts run-summary sites). re-check: git grep -n "Date.now() - consumed.run.startTime" origin/main -- packages/services/service-automation/src.

Options the #32161 dev measured (not ruled)

  • A. Add an optional waitMs (time suspended) to the run record; durationMs stays the total, and readers derive active time. Additive, no consumer breaks.
  • B. Add optional executionMs and waitMs beside durationMs. This duplicates a derivable value.
  • C. Redefine durationMs as active time only. This changes a published meaning.

The #32161 dev recommends A. Any new field is Clause-②: yes (it widens the published run record) and belongs to the spec lane. The restore path must sum the suspension intervals.

Dedupe (open and closed), run 2026-11-10 16:14 UTC: durationMs wait time resumed (11 hits), waitMs run record (5 hits), screen flow durationMs (23 hits). The first six of each read: none on point. #18179, #9510 and #25235 are about wait and suspension behaviour, #31843 about lock renewal, and #23940 and #24545 are QA run records. waitMs exists in packages/spec only in contracts/cluster-service.ts (lock waits), which is unrelated.

Activity

  1. added
    enhancement
    on Nov 10, 2026
  2. objectstack-fleet commented on Nov 10, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: lands in domain:server · p3 · pm:queue · 2026-11-10T17:02Z

    ⛔ Not a claim.

    • Lane: domain:server (the automation run record). A resumed run's durationMs excludes the time it waited for the user. p3, a misleading metric with no behaviour defect.

    Generated by Claude Code

  3. added
    domain:server
    pm:queue
    on Nov 10, 2026
  4. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4czXwx6JtQPvacrzzUw

    Ruled · maintainer · 2026-11-14T15:07Z

    Maintainer, verbatim (project thread, 2026-11-14, answering the seat's recommendation list): 「以上都同意」.

    Ruling: option A — an optional waitMs on the published run record; durationMs keeps its meaning. Clause-② yes (widening), contract review owed. Area A5 builds it.


    Generated by Claude Code

  5. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4cxHwXNcGcAHNerZsom

    Claim: area-lease pilot #33059, area A5 thread · 2026-11-14T22:43Z · p3 (A5 lease), building the maintainer's ruling 6879411530 (option A: optional waitMs on the published run record, durationMs keeps its meaning), dispatched to an os-dev subagent of this thread.
    Session: session_016WV4cxHwXNcGcAHNerZsom
    Account: os-elon-musk
    Branch: claude/area-A5-32284
    Worktree: objectstack-issue-32284
    Domain: domain:server
    Seat: domain:server#5 (area A5)
    File surface: packages/spec/src/automation/execution.zod.ts (the run record: one optional waitMs), its generated baselines and docs (authorable-surface, generated mdx), packages/services/service-automation/src run-record writers (engine.ts run-summary / suspension-restore sites near the durationMs computations, consumed-suspension-restore.ts), their tests, a changeset. Open #33431 edits other functions of engine.ts (lines ~2703, ~4769, ~5890–5915); not touched here. Stop on breach.
    Clause-②: yes (widening, per the ruling; contract review owed)
    Metadata-protocol: expected added if the authorable-surface baseline moves; the final value is declared from the diff
    Premise: re-measured on origin/main before any edit; premise_still_valid: false is a valid result

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 14, 2026
  7. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4cxHwXNcGcAHNerZsom
    os-dev-report

    {
      "issue": 32284,
      "status": "done",
      "branch": "claude/area-A5-32284",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/33511",
      "head": "50c4166cab",
      "session": "session_016WV4cxHwXNcGcAHNerZsom",
      "premise_still_valid": true,
      "clause_2": "yes (widening)",
      "metadata_protocol": "added",
      "lines_changed": "15 files, +649 / -10 vs merge base f068cde84d (source 178 added / 9 removed in service-automation, 22 in execution.zod.ts; tests 429; changeset 17; generated 3)",
      "summary": "Built ruling A (comment 6879411530): ExecutionLogSchema gains optional waitMs (int, min 0), the time a run spent suspended summed over all its pauses; durationMs keeps its meaning (total wall time) and its describe text is untouched, so active time is durationMs - waitMs. Premise re-measured on origin/main f068cde84d: durationMs does include the wait, but no pause instant is persisted anywhere (the suspension row has only the run start; created_at is the first pause only, updated_at moves on any re-save, the in-memory store has neither), so 'derive from existing persistence' was not possible and the engine now keeps one wait clock per suspension (SuspendedRun.activeMs = execution time at the pause; wait at any later instant = age - activeMs), persisted as sys_automation_run.active_ms, plus the published total on terminal rows as wait_ms; this sums any number of suspend/resume cycles and survives restarts and the consumed-suspension restore (the restore keeps the clock of the pause it re-arms, so the failed attempt and the stranded time count as wait). Never-suspended convention: the dispatch default was absent unless the neighbouring convention says otherwise; FlowRunSummary.failed/unmeasured in the same file are written 0 when measured and absent only when not tracked, so a run that never paused carries waitMs: 0 and absent means not recorded (missed entry, a pause parked before this release, a host store that does not round-trip the clock), stated in the describe, the changeset and the PR body. No legacy migration; old rows read waitMs as not recorded. The PR body (written once, at create) does not carry the PR template's Human Minimum checklist that #33438 carried; if the seat wants it, it is a seat-post-protocol edit.",
      "tests": "Suite readings on a tree byte-identical to head 50c4166cab except the changeset file (taken just before that commit): pnpm --filter @objectstack/spec test → Test Files 840 passed (840), Tests 26871 passed | 1 todo (26872), VERDICT command-exit 0. pnpm --filter @objectstack/service-automation test → Test Files 282 passed (282), Tests 3925 passed (3925), VERDICT command-exit 0. pnpm --filter @objectstack/service-automation typecheck (tsc + check:test-typecheck) → VERDICT command-exit 0. New pins by name (verbose run, 9/9 green): run-wait-time.test.ts 6 cases (never paused waitMs 0 / durationMs 100; one pause 18640 total, 18500 wait, 140 work; two pauses across three engines over one store sum 5000 + 30000 = 35000, durationMs 35147, loadTerminal 35000; cancel where it waits 2100 / 2000; restore path stranded 1120 / 1000, re-armed 1620 / 1520, completed 3640 / 3520, work 120; legacy suspension without a clock resumes with waitMs absent), each record parsed through ExecutionLogSchema; suspended-run-store.test.ts new describe 3 cases on the shared createFakeEngine table (active_ms cells 100 then 140, terminal cells duration_ms 35140 / wait_ms 35000 read back by a fresh engine; stranded row duration_ms 1140 / wait_ms 1000 / active_ms 100, fresh-process restore re-arms active_ms 100, final 13680 / 13540; a row without the columns reads not recorded). execution.test.ts: kept through parse, absent stays absent, -1 and 1.5 refused at ['waitMs']. On head 50c4166cab: pnpm --filter @objectstack/spec typecheck → VERDICT command-exit 0. Ablation (suspension sum forced to 0), on the committed head through scripts/ablation-replace.mjs wrap mode: anchor in waitOfPausedRun 'Math.max(0, elapsedMs - run.activeMs)' replaced by '0', anchor x1 → x0, replacement x0 → x1, blob 3c90925667af → 921ed18e4c41; the two pin files went 6 failed / 60 passed (66) - every summed-wait pin red (one pause, two pauses, cancel, restore, both store cell cases), the three that do not go through the clock (never paused 0, legacy absent, legacy row) stayed green, direction as predicted (red). Restored: blob 3c90925667af == HEAD blob, git diff HEAD empty, git status clean (re-read by hand after the tool's own proof). The tests import engine.ts from src, so no dist leg.",
      "gates": "Local subset on head 50c4166cab: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 115 commands (15 paths vs merge base f068cde84); each run serially with its exit code captured before any pipe: 113 exit 0, 2 exit 3 PREREQUISITE NOT MET (pnpm --filter @objectstack/spec run check:skill-examples - no built @objectstack/client / client-react declarations; pnpm check:dual-build-cjs-loads - needs every package's dist). dispatch-gates --ran with exit tails: 'Run reconciliation - 115 derived, 113 run, 2 NOT-MEASURED, 0 UNRUN', exit 0. NOT MEASURED: check:skill-examples and check:dual-build-cjs-loads, reason: exit 3 PREREQUISITE NOT MET, both run in CI Lint & Repo Gates. Outside the derivation: pnpm --filter @objectstack/spec check:generated named check:docs stale once, --fix regenerated execution.mdx and automation-api.mdx and re-checked check:docs green (authorable-surface.base.json untouched); node scripts/check-test-source-alias.mjs OK (2 changed test files judged); node scripts/check-nul-bytes.mjs OK; node scripts/check-platform-checklist.mjs --changed-from origin/main OK (26 anchors judged, 0 lost); eslint --no-inline-config over the 11 touched source and test files exit 0. Dependents: turbo ls --affected names 122 packages (everything depends on spec), a set blind to tests that read another package's source from disk, and the repo-root suites are not on that graph; narrowed, declared: only the run record's readers re-run locally - @objectstack/runtime typecheck (green after building @objectstack/driver-turso, whose missing dist gave 2 TS2307 in two unrelated test files on the first run) plus vitest of automation-run-detail-passthrough, automation-runs-unknown-flow, automation-run-doors-per-slot, automation-runs-query-validation, http-dispatcher (Test Files 5 passed, Tests 375 passed, VERDICT command-exit 0), and @objectstack/client typecheck + return-type-precision.test.ts (Tests 2 passed, VERDICT command-exit 0); the rest is CI's. test:repo not run locally (CI's Test Core). PR check-runs on 50c4166cab at read: 67 runs, 56 success, 10 skipped, 1 in_progress - TypeScript Type Check success, Type Check workspace / source gates / consumer gates / debt ledger success, Build Core success, Lint and Repo Gates success, Lint ESLint success, Lint PM dispatch-gates success, Check Changeset success, Test Core 1-7 of 8 success, Test Core (8/8) in_progress; skipped include Dogfood Regression Gate and Temporal Conformance (not scheduled on pull_request).",
      "dogfood_battery": "n/a - no ! in the PR title and Clause-2 is yes (widening), no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 - POST /repos/objectstack-ai/objectstack/pulls (draft PR 33511, via fleet-write relay); POST /repos/objectstack-ai/objectstack/issues/32284/comments (this report, via post-stamped.mjs). git push is not a REST write.",
      "open_questions": [
        {
          "question": "Ruling A allows one optional published member. Keeping the published value correct across a restart needed storage on the engine-owned sys_automation_run object: two nullable number columns, active_ms (the wait clock on a paused row and on a stranded row's consumed snapshot) and wait_ms (the summed wait on a terminal row). The object's own comment treats an added column as a human-decided surface. Are these two columns inside ruling A?",
          "options": [
            "A - keep both columns as built: the published waitMs is exact after any number of pauses, restarts and an operator restore; the published surface is still the one member",
            "B - keep wait_ms only and hold the clock in memory: a run resumed by a different process than the one that parked it (the normal screen-flow case) reads waitMs as not recorded",
            "C - no columns, derive from created_at / updated_at: wrong for a second pause (created_at is the first pause only) and for any re-save of the same pause (updated_at moves), and the in-memory store has neither"
          ],
          "recommendation": "A, because it is the only option where the published value is correct for an admin in the case the card was filed for (a screen flow answered after the process that paused it is gone); the columns are nullable, need no migration, and old rows read as not recorded."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none - content/docs/automation/flows.mdx (hand-written run-history section) could name waitMs; outside this PR's file surface; noted in the PR's Acceptance notes, not filed (doc polish, not a filing class)"
      ],
      "deviations": [
        "Commit trailers are Claude-Session plus 'Co-authored-by: Claude' as the dispatch requires; the harness reminder's model-named trailer was not used.",
        "engine.ts was touched only at type declarations (ExecutionLogEntry, SuspendedRun plus the two clock helpers, RunRecord), the execute() run-record sites in the 7660-7990 window, and the private finishRefusedRun wrapper's argument list near line 10009; nothing near 2703, 4769 or 5890-5915.",
        "Run-record writers and suspension-row readers touched beyond the files the dispatch named: run-history.ts, run-resume.ts, dag-traversal.ts, suspended-run-store.ts, and the column declarations in sys-automation-run.object.ts (see the open question).",
        "Generated docs: check:generated --fix also regenerated content/docs/references/api/automation-api.mdx (the run record appears there too), beside execution.mdx.",
        "Branch is 4 commits behind origin/main at report time; none touches packages/spec/src/automation, service-automation/src, the authorable-surface or the reference docs (git diff HEAD...origin/main on those paths is empty); not merged, the merge queue tests the merged tree."
      ]
    }
  8. added a commit that references this issue on Nov 16, 2026
    605d712
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverenhancementpm:dispatchedpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions