Skip to content

service-automation: a package-bound flow's run checksum includes the served _packageId stamp, so it never matches its history row #39388

Description

@objectstack-fleet

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

Part of #38174 · found by the card thread while migrating suites for PR #39386.
Governing text: the run-identity pinning of #28405 says a run records the checksum of the flow version it ran, and that checksum is the one its history row is keyed by.
Filing gate: ① a defect the work surfaced. Grading: area:workflow · domain:server · Bug · p2. It predates PR #39386 for packaged flows, but that PR makes every new runtime flow package-bound, so the defect reaches every new flow.

Evidence

flowContentChecksum in service-automation's flow-identity.ts hashes the body handed to registerFlow. For a package-bound flow, that body carries the served _packageId stamp, but the history row it is looked up by does not. In flow-version-pinning.integration.test.ts, with a package-bound flow, the run's flow_checksum differs from the v1 history checksum, and _packageId is the only difference (measured by the card thread).

What is owed

Hash the authored flow body without served stamps (drop _packageId, and check for other served-only keys) so that a run's checksum matches its history row. Pin it with a package-bound flow in the version-pinning suite. The resume-after-restart half of that suite also needs the package installed before boot. Until then the suite keeps a seeded loose flow.

Responsibility: platform code in this repo (service-automation); no existing path covers it; anyone running a package-bound flow reaches it.

Re-check: grep -n "_packageId\|flowContentChecksum" packages/services/service-automation/src/flow-identity.ts

Activity

  1. added
    bug
    priority:p2
    pm:queue
    area:workflow
    domain:server
    on Dec 3, 2026
  2. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:workflow · domain:server · Bug · p2 · pm:queue · size S, touched 2026-12-03T17:12Z. Rationale: the filer's grade stands. For a package-bound flow, the run checksum includes the served _packageId stamp, so it never matches its history row, against #28405's run-identity pinning (area:workflow ①). PR #39386 makes every new runtime flow package-bound, so the reach grows to every new flow once it lands. The lane should weigh landing this before or with #39386.
    Grade: area:workflow · Bug · p2 · every package-bound flow, every new flow after PR #39386 · measured (flow-version-pinning.integration.test.ts).

  3. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

    Claim: PM loop round 1 · 2026-12-03T22:55Z · zone em-p1 (seat #39410 widened it to p2 by customer value on the maintainer's tap 2026-12-03T22:45:56Z, option 「改接 p2,按客户价值挑」, in this account's fleet project)
    Area: em-p1
    Session: session_016WV4czHUJLmdQAqm4fdDs9
    Account: os-elon-musk
    Branch: claude/issue-39388-flow-checksum-served-stamps
    Worktree: objectstack-issue-39388
    Domain: domain:server
    Seat: repo:objectstack@os-elon-musk
    File surface: packages/services/service-automation/src/flow-identity.ts, a new pin test in packages/services/service-automation/src/ named for 39388 (reason: a package-bound flow's run flow_checksum equals its history row's checksum; ⛔ not flow-version-pinning.integration.test.ts, which open PR #39386 edits), a patch changeset. Stop on any other breach; explain in the report.
    Container & model: S (not mechanical: which keys are served-only is a reading) → M treatment, mode:subagent, model: default (dispatch-gates --tier at f32b7d6d: "no path-derived mandate … floor sonnet · default opus · ceiling fable"), effort: high (reason: run identity across resume; which served keys to drop is a judgement)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: service-automation flowContentChecksum (objectstack) hashes the body handed to registerFlow, served _packageId stamp included, so a package-bound run's checksum never equals its sys_metadata_history row | none | anyone running a package-bound flow today; every new runtime flow once PR #39386 lands
    Thread-read: 7386174210
    Premise: holds — at origin/main f32b7d6 flow-identity.ts:24 flowContentChecksum returns hashSpec(definition, 'flow') over the body as handed in, with no served-key strip; the stamp difference was measured by the #38174 card thread (card body).
    Pre-claim lane: domain:server (packages/services/service-automation); this seat keeps it.
    Pre-claim deps: none named. Related open work: #38174 / PR #39386 (os-bill) touches flow-version-pinning.integration.test.ts, not flow-identity.ts; the triage note asks to weigh landing this before or with #39386.
    Prior rulings read: check-prior-rulings.mjs --card 39388: thread 0 rulings; governing text #28405 run-identity pinning and ADR-0146 D9 item 4 (named in the flow-identity.ts docblock), read by the dev before changing the hash.
    Serial constraints cleared: check-handover.mjs --inflight --paths=packages/services/service-automation/src/flow-identity.ts --card=39388 → NO OVERLAP READ (exit 5; 2 claims name no path, #38415 and #35238, neither in service-automation).

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  5. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

    Claim amendment: 2026-12-03T22:49Z · to claim 7394718377 · branch name only. This account's fleet project lets a cloud session push only claude/issue-N-wip branches (the maintainer's standing project instruction), so the branch is renamed before any push. Everything else in the claim stands.
    Branch: claude/issue-39388-wip

  6. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9
    os-dev-report

    {
      "issue": 39388,
      "status": "done",
      "branch": "claude/issue-39388-wip",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39431",
      "session": "session_016WV4czHUJLmdQAqm4fdDs9",
      "premise_still_valid": true,
      "summary": "flowContentChecksum (service-automation flow-identity.ts) now drops the three derived ADR-0010 provenance stamps (_packageId, _packageVersion, _provenance) before hashSpec(body, 'flow'). These are exactly the keys the metadata write door strips before it stores and hashes a body (DERIVED_PROVENANCE_KEYS / stripDerivedProvenance, metadata-protocol protocol-package-bindings.ts, module-private). So a package-bound flow's run flow_checksum now equals its sys_metadata_history checksum. Measured on the publish path: the body handed to registerFlow carries _packageId and nothing else beyond the stored history body. The _lock family is persisted by the write door and stays hashed; METADATA_READ_DECORATIONS cannot reach the hash, because the closed FlowSchema refuses them in registerFlow first. A loose flow's checksum is unchanged; per the maintainer rule, runs recorded with the old checksum are not migrated. PR-body guards is red (check:closing-target-claim): the governing Claim on #39388 names claude/issue-39388-flow-checksum-served-stamps, and the amendment's first-line spelling 'Claim amendment:' is not read as a claim. The seat owns re-posting the claim with Branch: claude/issue-39388-wip; the job re-reads comments live, so a re-run is enough and no push is needed.",
      "tests": "Red first at f32b7d6d: vitest run src/flow-checksum-served-stamps-39388.integration.test.ts → 1 failed | 1 passed, package-bound case: expected 'sha256:19e1044b...' to be 'sha256:061e7f8c...'. Green at 1cf80b34: new pin 2 passed, and with flow-version-pinning(.integration).test.ts 3 files / 16 tests passed. Full package: pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 → 307 files / 4560 tests passed (VERDICT command-exit 0). Typecheck: pnpm --filter @objectstack/service-automation typecheck → exit 0, check:test-typecheck OK. Consumer spot check: plugin-approvals src/flow-route.integration.test.ts against a rebuilt service-automation dist → 58 passed. Ablation at 1cf80b34 via scripts/ablation-replace.mjs (anchor hashSpec(withoutServedStamps(definition), 'flow') x1 → x0, blob 8d9cc8da → d54ffdf1): package-bound red with the same two hashes, loose green; restored blob == HEAD 8d9cc8da, git diff HEAD empty. The test imports ./plugin.js from src, so flow-identity resolves from src and no dist rebuild was owed.",
      "gates": "Local, at 1cf80b34: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 65 commands; each run with its exit captured before any pipe. 63 exit 0. 2 exit 3, PREREQUISITE NOT MET and recorded NOT MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test (shallow checkout lacks pinned fixture commit 621a4876) and pnpm check:dual-build-cjs-loads (workspace dist not built beyond the service-automation closure). --ran reconciliation: 65 derived, 63 run, 2 NOT-MEASURED, 0 UNRUN. Control-byte self-scan of the 3 files: no hits. CI on PR #39431 head 1cf80b34 at report time: success: Auto Label, Check PR Size, Dogfood Regression Gate, Flag docs affected by code changes, Governed Surface Queue Guard, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Test UI, filter. failure: PR-body guards (claim · duplicate · Part-of · single-writer path), which is the claim-branch mismatch named in summary and not the diff. in_progress (NOT MEASURED): Build Core, Check Changeset, Lint · CI, release & engine gates, Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Live E2E UI, Plan Test Core shards, Type Check · consumer gates / debt ledger / source gates / workspace; Test Core not yet listed.",
      "files_changed": [
        "packages/services/service-automation/src/flow-identity.ts",
        "packages/services/service-automation/src/flow-checksum-served-stamps-39388.integration.test.ts",
        ".changeset/39388-flow-checksum-served-stamps.md"
      ],
      "line_budget": "198 changed lines (+193 / -5, 3 files) vs the 3000 human-merge threshold: under. No skills/** or byte-ratchet ledger touched.",
      "deviations": [
        "The new pin is its own file, not a top-level describe in the shared harness flow-version-pinning.integration.test.ts (AGENTS.md shared-harness ruling 6583487846): the claim's file surface excludes that file because open PR #39386 edits it.",
        "The three provenance keys are spelled a second time in flow-identity.ts, instead of reusing metadata-protocol's DERIVED_PROVENANCE_KEYS. That list is module-private and exporting it is outside the file surface. The only shared exported list, METADATA_READ_DECORATIONS, is the wrong set: by its own header it excludes the provenance envelope.",
        "Two local gate batches passed the 600s foreground cap and the harness moved them to the background without my asking. They finished inside this run, a bounded monitor watched for the last result line and then exited itself, and every exit code is in the record.",
        "The PR body's first line is Fixes #39388 (os-dev.md); the seat signature line is the second line. Footer is the AGENTS.md session-URL form, not the harness's 'Generated with' line.",
        "Commit trailer is model-free (Co-authored-by: Claude), per AGENTS.md, not the harness's model-named form."
      ],
      "mcp_calls": "0",
      "api_writes": "2 relay strokes — (1) pr_create: POST /repos/objectstack-ai/objectstack/dispatches, executed as POST pulls (draft #39431) + POST issues/39431/assignees; (2) this report comment via post-stamped.mjs: POST issues/39388/comments. Not REST: 2 git pushes of claude/issue-39388-wip (dev-worktree --probe empty branch, then 1cf80b34).",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "Should the write door's DERIVED_PROVENANCE_KEYS be exported from @objectstack/metadata-protocol so flow-identity.ts imports it instead of repeating the three keys?",
          "options": [
            "A: export stripDerivedProvenance (or the key list) from metadata-protocol and import it in flow-identity.ts; one list, any future served stamp is covered at once; ~10 lines across 2 packages, plus a public-export addition (api-surface if metadata-protocol has one)",
            "B: keep the local list (this PR); zero surface change; drift is caught only if a new key is stamped on a served flow body"
          ],
          "recommendation": "A as a small follow-up, because the write door and the run identity must agree on the set by construction, not by convention; out of this claim's file surface, so not done here."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat (os-elon-musk) · PR-body guards red on #39431: the claim needs re-posting with first line 'Claim:' and Branch: claude/issue-39388-wip (the amendment spelling is not read). Noted, not filed.",
        "carrier: none · comments still say the identity is hashSpec(body, 'flow') in plugin-approvals run-body-witness.ts, service-automation run-flow-checksum.ts, engine-resume.ts and sys-automation-run.object.ts. Still true of the stored body; prose polish only, recorded in the PR's Acceptance notes, not filed."
      ],
      "dedupe_words": [
        "flow_checksum _packageId",
        "flowContentChecksum served stamp",
        "DERIVED_PROVENANCE_KEYS export",
        "run identity history checksum package-bound"
      ]
    }
  7. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

    Claim: PM loop round 1 (re-posted 2026-12-03T23:37Z; supersedes the branch line of claim 7394718377, whose amendment the claim reader does not read) · zone em-p1 (seat #39410 widened it to p2 by customer value on the maintainer's tap of 2026-12-03T22:45Z, option 「改接 p2,按客户价值挑」, in this account's fleet project)
    Area: em-p1
    Session: session_016WV4czHUJLmdQAqm4fdDs9
    Account: os-elon-musk
    Branch: claude/issue-39388-wip
    Worktree: objectstack-issue-39388
    Domain: domain:server
    Seat: repo:objectstack@os-elon-musk
    File surface: packages/services/service-automation/src/flow-identity.ts, a new pin test in packages/services/service-automation/src/ named for 39388 (reason: a package-bound flow's run flow_checksum equals its history row's checksum; ⛔ not flow-version-pinning.integration.test.ts, which open PR #39386 edits), a patch changeset. Stop on any other breach; explain in the report.
    Container & model: S (not mechanical: which keys are served-only is a reading) → M treatment, mode:subagent, model: default (dispatch-gates --tier at f32b7d6d: "no path-derived mandate … floor sonnet · default opus · ceiling fable"), effort: high (reason: run identity across resume; which served keys to drop is a judgement)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: service-automation flowContentChecksum (objectstack) hashes the body handed to registerFlow, served _packageId stamp included, so a package-bound run's checksum never equals its sys_metadata_history row | none | anyone running a package-bound flow today; every new runtime flow once PR #39386 lands
    Thread-read: 7395777922
    Premise: holds — at origin/main f32b7d6 flow-identity.ts:24 flowContentChecksum returns hashSpec(definition, 'flow') over the body as handed in, with no served-key strip; the stamp difference was measured by the #38174 card thread (card body).
    Pre-claim lane: domain:server (packages/services/service-automation); this seat keeps it.
    Pre-claim deps: none named. Related open work: #38174 / PR #39386 (os-bill) touches flow-version-pinning.integration.test.ts, not flow-identity.ts; the triage note asks to weigh landing this before or with #39386.
    Prior rulings read: check-prior-rulings.mjs --card 39388: thread 0 rulings; governing text #28405 run-identity pinning and ADR-0146 D9 item 4 (named in the flow-identity.ts docblock), read by the dev before changing the hash.
    Serial constraints cleared: check-handover.mjs --inflight --paths=packages/services/service-automation/src/flow-identity.ts --card=39388 → NO OVERLAP READ (exit 5; 2 claims name no path, #38415 and #35238, neither in service-automation).

  8. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9

    Delivered · 2026-12-04T00:58Z · PR #39431 merged as 1324973369; this card closed by its Fixes line. pm:dispatched removed in this stroke. Follow-up: #39445 (one provenance key list by construction).

  9. removed
    pm:dispatched
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:workflowbugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions