Skip to content

service-automation: a retried run skips the flow's start condition (errorHandling.strategy 'retry') #33935

Closed

Description

@objectstack-fleet

domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag

Filing gate: found by contract review 6896167662 ③ (review#2) on PR #33799 / card #33757. This is engine behaviour outside that PR.

What happens. In execute (packages/services/service-automation/src/engine.ts), the start node's condition is evaluated first, at about L7724. When it does not hold the run is skipped (about L7729). If evaluating it throws, the catch at about L8166 hands a definition with errorHandling.strategy: 'retry' to retryExecution. Its attempts go through executeWithoutRetry (dag-traversal.ts about L1232–L1320), which goes from the start-node lookup straight to validateNodeInputSchemas and executeNode without evaluating the start condition. So when a start condition throws on attempt 1, the later attempts run the nodes ungated.

Why it matters. The start condition is the author's gate for whether the flow should run at all. A condition that faults, for example a CEL error against the record, should not open the gate on retry.

Fix shape (for the engine's owner). Either re-evaluate the start condition on every retry attempt, or treat a faulting start condition as non-retryable (answer 'failed' as the default strategy does). Pin it with a test: a throwing condition plus strategy: 'retry' runs no node.

Contract note. The dry-run contract (#33757, PR #33799) describes the default-strategy behaviour and names this retry divergence. When this card lands, that qualifier can be dropped.

Dedupe: repo:objectstack-ai/objectstack is:issue is:open executeWithoutRetry start condition returns no open card. Suggested lane: domain:server (service-automation). Suggested grade: p2 (a gate bypass on an error path). Triage routes and may re-grade. Filed while spec seat 1 is winding down under 「当前任务处理完,合并后就下班」, so it is not claimed.

Activity

  1. added
    priority:p2
    pm:queue
    finding
    domain:server
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first-touch audit → domain:server · lease:A5 · p2 confirmed · 2026-11-15T16:01Z

    ⛔ Not a claim. Requested by domain:server#5 (mailbox comment 6897257532).

    When a flow's start condition throws on attempt 1 and the flow declares errorHandling.strategy: 'retry', the later attempts go through executeWithoutRetry and run the nodes without evaluating the start condition. The author's gate on whether the flow runs at all is bypassed, so its writes and outbound calls can happen when they should not. It needs a faulting condition plus the retry strategy, so the reach discount keeps it at p2. The fix evaluates the start condition on every attempt (a fault stays a fault, it never becomes a pass). A5 (service-automation); area S6 claims it.

  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUZKdq3PK2Sab53cT3

    Claim: server area-lease mode (#33751 §2), area S6 lease A5, dispatched by seat domain:server#5 area thread · executed by an os-dev sub-agent (mode:subagent) · posted at 2026-11-15T16:07Z
    Session: session_01QsR2jUZKdq3PK2Sab53cT3
    Account: zhuangjianguo
    Branch: claude/area-A5b-33935
    Worktree: objectstack-issue-33935
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/services/service-automation/src/dag-traversal.ts (executeWithoutRetry: the start-condition evaluation on each retry attempt), packages/services/service-automation/src/engine.ts only where execute's start-condition gate or its catch hands to retryExecution must share one evaluator, a new test file named by the card, a patch changeset (stop on breach; explain in the report)
    Container & model: S, mode:subagent, model: default (no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack service-automation: a flow whose start condition throws on attempt 1 and declares errorHandling.strategy 'retry' runs its nodes ungated on later attempts | the default strategy, which answers 'failed' | any flow with a faulting start condition and the retry strategy
    Thread-read: 6897296881
    Premise: holds
    Route: the triage audit's: evaluate the start condition on every attempt; a fault stays a fault (retried, never a pass); a condition that does not hold skips the run as on attempt 1.
    Serial constraints cleared: the #33893+#33905 fold (S6, branch claude/area-A5b-33893 at 75b2f32) edits engine.ts and flow-slots.ts, not dag-traversal.ts; built in parallel, git merge-tree against it and origin/main before push (14:45Z rule).
    Pre-claim lane: server because packages/services/service-automation/src/dag-traversal.ts
    Pre-claim deps: none open (#33757 / PR #33799's dry-run contract names this divergence; when this lands that qualifier can be dropped, a follow-up for the spec owner, not a dependency).
    Prior rulings read: docs/adr/** grep start condition / strategy 'retry' / retryExecution → ADR-0031 (retry exists as exponential backoff; nothing makes a retry skip the start gate), ADR-0044 (start conditions gate approval-mirrored flows); triage audit 6897296881 (route); filing note on PR #33799 contract review 6896167662. No ⛔ conflict; no test pins ungated retries.


    Generated by Claude Code

  4. added
    pm:dispatched
    and removed
    pm:queue
    finding
    on Nov 15, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUZKdq3PK2Sab53cT3
    os-dev-report

    {
     "issue": 33935,
     "status": "done",
     "branch": "claude/area-A5b-33935",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/34090",
     "pr_number": 34090,
     "head_sha": "b55412e9bfdbda1e4b9b872bce83a4112c696a09",
     "session": "session_01QsR2jUZKdq3PK2Sab53cT3",
     "premise_still_valid": true,
     "summary": "H1 measured and holds: execute() evaluated the start condition, the fault reached the catch and retryExecution, and executeWithoutRetry (dag-traversal.ts) went from the start-node lookup straight to validateNodeInputSchemas and executeNode; with the fix ablated the node ran on a retry attempt (runs.count 1). H2: one shared evaluator, startConditionHolds in dag-traversal.ts, now called by execute() (replacing its inline copy, behaviour unchanged) and by executeWithoutRetry at the same position (after the start-node lookup, before the input-schema guard); not-hold answers the same condition_not_met skip, a throw is a fault that consumes one retry attempt, and an exhausted run ends failed with no node run. H3 holds: throw-then-hold runs the nodes once, throw-then-not-hold skips with no node. Engine.ts change is limited to the import, the execute() gate calling the shared evaluator, and evaluateCondition on the executeWithoutRetry host. Patch changeset with the claim's two declaration lines verbatim.",
     "tests": "New packages/services/service-automation/src/start-condition-retry-33935.test.ts, 5 pins (fault every attempt + retry: 0 node runs, status failed, 3 evaluations, 3 failed rows; fault then hold: 1 node run; fault then not-hold: condition_not_met skip, 0 node runs; CONTROL default strategy: failed, 1 evaluation, 1 failed row; CONTROL retry with hold/not-hold on attempt 1). At final head b55412e9 (after merging origin/main, install + closure rebuilt): service-automation typecheck exit 0 (tsc + check:test-typecheck OK); service-automation test exit 0, Test Files 283 passed (283), Tests 4006 passed (4006); direct dependents trigger-record-change 12/12 files 122/122 tests, trigger-schedule 13/13 files 256/256, plugin-approvals 120/120 files 1652/1652, all exit 0. Retry family (start-condition-retry-33935, input-schema-retry-parity, flow-retry-attempt-count, retry-attempt-pause) 4/4 files 20/20 at 94cd8fbb. Ablation at 94cd8fbb (fix committed first) via scripts/ablation-replace.mjs under the verify lock: anchor 'if (!startConditionHolds.call(this, startNode, variables, runContext)) {' x1 -> x0, replacement 'if (false /* ABLATED ... */) {' x0 -> x1, blob 136e5e1ada9b -> a543c75e5f3f; result Tests 3 failed | 2 passed (5): main pin red 'AssertionError: expected 1 to be +0' at expect(runs.count).toBe(0) (the node ran on a retry attempt); pin 2 red 'expected evaluateCondition to be called 2 times, but got 1 times'; pin 3 red (output {} instead of skipped/condition_not_met); both CONTROLs green. Restore: blob after restore == HEAD blob 136e5e1ada9b, git diff HEAD empty. No dist preflight: the test imports ./engine.js relatively, so the subject resolves to src.",
     "gates": "Local: dispatch-gates --commands --repo objectstack-ai/objectstack derived 71 commands at b55412e9 (same list as at cd76bb21); 70 run, each exit captured before any pipe, all EXIT=0, including check:type-check-debt (re-measure OK, 0 raw tsc errors) and check:dts-closure / check:lean-entry-closure / check:sourcemap-no-sources-content (exit 3 prerequisite on the first sweep before the build, exit 0 on the final head). check:dual-build-cjs-loads not run locally (left to CI). --ran reconciliation: 71 derived, 70 run, 0 NOT-MEASURED, 1 UNRUN (check:dual-build-cjs-loads). eslint on the 3 touched source files exit 0. PR body gates on the final body: check-changeset-no-major exit 0, check-adr-0087-registration exit 0 (1 non-breaking changeset), check-closing-keyword-parity exit 0, check-partof-closing-keyword exit 0. Control-byte scan of the body, changeset and test file: no hits. dispatch-gates --tier on the four paths: no path-derived mandate. git merge-tree --write-tree --name-only against origin/claude/area-A5b-33893 (75b2f32c) and origin/main: clean, no conflicted paths; that branch's engine.ts hunks do not touch the start-condition gate or the executeWithoutRetry host. CI check-runs: in_progress at report time (PR opened 18:20Z), not waited on.",
     "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm (Clause-②: no)",
     "declarations": "Clause-②: no and Metadata-protocol: none copied verbatim from the claim into PR body and changeset. Self-check: changeset-no-major and adr-0087-registration green with these lines. The behaviour change is on an error path of the engine (a run that executed nodes ungated after a start-condition fault now fails or skips); no published accept set, schema key, export or wire shape moves, so I read it as not served-to-refused for any authored metadata. Declaration left as claimed; the seat should confirm.",
     "files_changed": [
      "packages/services/service-automation/src/dag-traversal.ts",
      "packages/services/service-automation/src/engine.ts",
      "packages/services/service-automation/src/start-condition-retry-33935.test.ts",
      ".changeset/33935-start-condition-retry.md"
     ],
     "line_budget": "245 changed lines (+230 / -15, 4 files), under the 3000 human-merge threshold; no skills/** touched",
     "mcp_calls": "3 — reads only: mcp__github__issue_read get, mcp__github__issue_read get_comments, mcp__github__pull_request_read get",
     "api_writes": "2 — relay pr_create (POST /repos/objectstack-ai/objectstack/dispatches, run 43745920394, PR 34090, 5638 bytes stored identical); os-dev-report comment on issue 33935 via post-stamped. Plus git pushes (not REST).",
     "deviations": [
      "dev-common asks for pnpm lint; os-dev.md says the repo-level lint scan is CI's, so I ran eslint on the three touched source files only (exit 0).",
      "Direct dependents: ran trigger-record-change, trigger-schedule and plugin-approvals (the consumers of start conditions and retry); not run locally: cli, client, verify, connector-mcp/openapi/rest/slack, qa/dogfood, examples app-showcase/app-todo. The package's public export surface is unchanged (index.ts does not re-export dag-traversal.ts); declared narrowing, CI runs them.",
      "check:dual-build-cjs-loads left to CI (1 UNRUN in the --ran reconciliation).",
      "The first sweep ran at cd76bb21 alongside my locked build; superseded by a full second sweep at the final head b55412e9.",
      "One locked verify run was cut by my own timeout (exit 124) after a 409 s queue wait, mid-build; the lock was confirmed free with no orphans, and the run was redone clean.",
      "One unlocked tsc --noEmit of service-automation after a one-line test type fix; the full typecheck later re-ran under the lock.",
      "Lock wait about 55 min behind the sibling 33893 verify run (its dogfood battery); the holder stayed alive and progressing throughout.",
      "Commit trailers are model-free (Co-Authored-By: Claude), per the repo rule, not the harness reminder's model-named form."
     ],
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: none · noted, not filed (read-only inference, no repro): executeWithoutRetry has no re-entrancy loop guard of its own; when attempt 1 faults at the start condition, execute() never added the reentry key, so retry attempts run without it held. A re-entrant dispatch from a retry attempt's own write still meets the guard one level deeper in execute(), so I saw no loop.",
      "follow-up for the spec owner, not a defect: the dry-run contract's retry qualifier (33757 / PR 33799) can be dropped once this lands; stated in the PR body."
     ],
     "loose_ends": []
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpm:dispatchedpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions