Skip to content

plugin-auth rate limits over-admit a concurrent burst in ONE process (incrementFixedWindow reads then writes across an await: 20 of 20 admitted), and the shared cache store is never reached because PluginContext has no getServiceAsync #29053

Closed

Description

@objectstack-fleet

repo:cloud#2 · os-zhuang · session_0123kRqqdpAJWYMgsgdAJX4G

Filing gate ①: a measured defect, found by cloud#3478 (environment sign-in burst on staging, cloud#3417 S2) and reproduced in one process. Cloud worked around it at its own auth door (PR cloud#3481, a per-environment, per-address serializer). The framework counter is still wrong for every other caller, the control plane included.

What happens

  1. One process over-admits. packages/plugins/plugin-auth/src/rate-limit-storage.ts incrementFixedWindow() does get → compute → set across awaits. Its docblock accepts a slight over-admit between nodes, but the same race happens inside one process: with a 3 per 10 s sign-in rule, 6 concurrent requests were all admitted (6 × 401, no 429), and 20 concurrent requests were all admitted too. Readers: the sign-in/sign-up limiter (line ~270), invitation-preview.ts, and the OTP / SMS budget (auth-manager-email-sms-delivery.ts).
  2. The shared store is never used. auth-plugin.ts (around 674–684) resolves the cache through ctx.getServiceAsync?.('cache'), but the PluginContext handed to plugins has no getServiceAsync. The optional call returns undefined, so every counter falls back to the per-process map, and every environment kernel logs "no cache service". The ADR-0069 D2 promise (one count across nodes, the SMS budget not multiplied by N) does not hold.

Ask

  • Make the per-process store's increment atomic per key (for example a per-key promise chain or a synchronous in-memory increment), and plumb an atomic INCR through ICacheService where the adapter has one, as the docblock already plans.
  • Resolve cache through the context API plugins actually get, or add getServiceAsync to PluginContext deliberately, with a test that a registered async cache is the store the limiter writes to.
  • Tests: a concurrent burst of N > limit against one key admits exactly limit, with an ablation.

Business reason

The sign-in limiter is the first defence against password guessing on every public sign-in page, and the OTP budget is paid SMS. Today a concurrent burst gets unlimited guesses within a window, and the budget is per process.

Reader

The plugin-auth owner, through objectstack triage. After this lands and cloud's pin carries it, cloud can decide whether to keep its door-level serializer (cloud#3478).

Dedup

Searched open objectstack issues for "incrementFixedWindow", "rate limit atomic" and "getServiceAsync cache plugin-auth": none open.

Activity

  1. added
    bug
    priority:p2
    domain:cloud
    and removed
    domain:cloud
    on Nov 2, 2026
  2. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: domain:server · area:identity (p2 and security kept) · 2026-11-02T07:03Z

    ⛔ Not a claim.

    • Read fresh. A rate limit must hold under concurrency inside one process, and must reach its shared store. Platform first: the framework counter is fixed for every caller, not only cloud's door, which has its own serializer. domain:server. The priority and handling stay with the maintainer, under the standing rule for security findings; ⛔ add no further mechanism here.

    Generated by Claude Code

  3. added
    area:identity
    domain:server
    pm:queue
    on Nov 2, 2026
  4. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Maintainer ruling on this security card · 2026-11-02T07:52Z

    The maintainer answered triage's options in the triage session, verbatim: 「A+C 同意」.

    • A, how this card is fixed: domain:server fixes it from this card, as queued. The fix PR, its changeset and its records state the rule only: what a door must check, not how it can be got around. ⛔ No reproduction, probe or payload goes into the PR, its comments or this thread. Anything more that the fix needs goes through the PM session.
    • C, how the next one is filed: to the filing seat repo:cloud#2. The standing rule is 「对于测试中遇到的安全问题,不适合提交issue 的,只是使用pm-dispatch技能派发」. A security finding (an authentication or authorization gap, a cross-tenant read, a bypassable limit, a secret leak) is dispatched through pm-dispatch to a dev, with its mechanism kept in the session, and is never filed as an issue. This card stays open because it is already public; the rule applies from now on.

    Generated by Claude Code

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 1 · card thread · 2026-11-02T08:16Z
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is opened by the project coordinator and named in a follow-up claim once it reports its branch
    Account: os-steve (the seat's linked user; the card's assignee)
    Branch: pending — the card thread's harness-pinned branch, written into a follow-up claim before the dev starts
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted on this card by triage 6571956503, verbatim 「A+C 同意」: domain:server fixes it from this card; the PR, changeset and records state the rule only, ⛔ no reproduction, probe or payload on any public surface.
    File surface: packages/plugins/plugin-auth/src/ (the rate-limit store's increment, the cache resolution in the auth plugin, their tests), changeset; packages/core/src/ only if the cache must be resolved through an existing context API change (a new public PluginContext member is NOT in scope: it stops at needs_decision). ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is plugin-auth's fixed-window rate-limit store and its cache wiring · a counter admits more than its limit under concurrency in one process, and the shared store it was built to use is never reached · reached by every public sign-in page and the paid OTP budget of every deployment
    Thread-read: 6571956503
    Premise: holds (read at origin/main a4015ab47b: auth-plugin.ts still resolves the cache through an optional getServiceAsync the plugin context does not carry; the store's increment reads then writes across an await)
    Serial constraints cleared: no open PR touches packages/plugins/plugin-auth/** (file lists of the 55 open claude/ PRs read at claim time); auth-stack version-family overrides untouched.
    Resume-from: none — fresh from origin/main

    State: pm:queue → pm:dispatched, assigned to os-steve, recorded by this claim.

  7. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 1 · card thread · branch named · 2026-11-02T08:16Z (supersedes 6572358032, which had the branch pending)
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is session_01ADHkmPtGEJ1jqz6awM6fkJ
    Account: os-steve (the seat's linked user; the card's assignee)
    Branch: claude/project-thread-fk1k2s (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted on this card by triage 6571956503, verbatim 「A+C 同意」: domain:server fixes it from this card; the PR, changeset and records state the rule only, ⛔ no reproduction, probe or payload on any public surface.
    File surface: packages/plugins/plugin-auth/src/ (the rate-limit store's increment, the cache resolution in the auth plugin, their tests), changeset; packages/core/src/ only if the cache must be resolved through an existing context API change (a new public PluginContext member is NOT in scope: it stops at needs_decision). ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is plugin-auth's fixed-window rate-limit store and its cache wiring · a counter admits more than its limit under concurrency in one process, and the shared store it was built to use is never reached · reached by every public sign-in page and the paid OTP budget of every deployment
    Thread-read: 6572358032
    Premise: holds (read at origin/main a4015ab47b: auth-plugin.ts still resolves the cache through an optional getServiceAsync the plugin context does not carry; the store's increment reads then writes across an await)
    Serial constraints cleared: no open PR touches packages/plugins/plugin-auth/** (file lists of the 55 open claude/ PRs read at claim time); auth-stack version-family overrides untouched.
    Resume-from: none — fresh from origin/main

    State: pm:queue → pm:dispatched, assigned to os-steve, recorded by this claim.

  8. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmPtGEJ1jqz6awM6fkJ
    os-dev-report

    {
      "issue": 29053,
      "status": "done",
      "branch": "claude/project-thread-fk1k2s",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/29216",
      "session": "session_01ADHkmPtGEJ1jqz6awM6fkJ",
      "premise_still_valid": true,
      "summary": "Inside one process, updates of one counter key in @objectstack/plugin-auth are now serialised (new internal per-key-serial.ts): incrementFixedWindow (every fixed-window caller: better-auth customStorage, invitation preview, cacheSecondaryStorage, the subpath's external callers) and OtpSendGuard.checkAndRecord (declared in-place fix, same defect class, a reader the card names), so a limit admits exactly its limit of a concurrent burst against one key, in the per-process store and in the cache alike. The cache is resolved through the context's existing getKernel().getServiceAsync (value and factory registrations), with ctx.getService on a LiteKernel host (new internal kernel-cache.ts); no PluginContext member, no packages/core or packages/spec edit. The kernel's own in-memory stand-in (self-described degraded, ADR-0076 D12) is not counted in, so cache-less ObjectKernel deployments keep the bounded fallback and its true warning (open question 1). Premise measured at origin/main 2af0ae2a: PluginContext (packages/core/src/types.ts) and the kernel's context object carry no getServiceAsync; ICacheService is in packages/spec with no atomic increment, so the cross-node path stays as documented.",
      "tests": "On 259b269f: pnpm --filter '@objectstack/plugin-auth...' build VERDICT command-exit 0; pnpm --filter @objectstack/plugin-auth test: Test Files 210 passed (210), Tests 3629 passed | 10 skipped (3639); spec check:generated: all 14 generated artifacts up to date. On 7f52bb00 (comment-only after 259b269f): rate-limit-concurrency, kernel-cache, auth-plugin, rate-limit-storage, rate-limit-storage-isolation, otp-send-guard: Test Files 6 passed (6), Tests 175 passed (175); typecheck exit 0 (check:test-typecheck OK). New: rate-limit-concurrency.test.ts 9 cases, kernel-cache.test.ts 10 cases (real ObjectKernel/LiteKernel contexts and the composed SQL+ObjectQL+AuthPlugin stack). Ablations via scripts/ablation-replace.mjs, src read by relative import (no dist in the path), each restored to the HEAD blob with git diff HEAD empty: (1) incrementFixedWindow unserialised: 5 failed, e.g. 'AssertionError: expected 20 to be 3 // Object.is equality' and on the composed stack 'expected [ { allowed: true, ...(1) }, ...(19) ] to have a length of 3 but got 20'; (2) OTP check unserialised: 3 failed, 'expected [ { ok: true }, { ok: true }, ...(18) ] to have a length of 1 but got 20'; (3) ObjectKernel leg back to ctx.getServiceAsync?.: 7 failed, incl. 'expected undefined to be InProcessCounterStore' and auth-plugin.test.ts 'counts in the cache registered AFTER init' ('expected +0 to be 1'); (4) LiteKernel leg removed: 1 failed ('expected undefined to be InProcessCounterStore'); (5) degraded skip removed: 2 failed ('expected { __serviceInfo: ... } to be undefined', '... to be an instance of InProcessCounterStore').",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack on 7f52bb00: 65 derived (same list as on 259b269f); all 65 run, stdin /dev/null, exit captured before any pipe: 65 exit 0. On 259b269f two first read exit 3 (prerequisite) and exit 0 after it was met: check-plugin-teardown-shape --self-test (pinned fixture commit fetched), check:dual-build-cjs-loads (turbo build ./packages/**; 115 require entries across 70 packages load). --ran on 7f52bb00: 65 derived, 65 run, 0 NOT-MEASURED, 0 UNRUN (derived zero). Lint: eslint --no-inline-config packages/plugins/plugin-auth on 7f52bb00 exit 0, no findings (repo-wide pnpm lint is CI's). CI check-runs: in_progress at report time, not read.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "5 — all reads: issue_read get (1), issue_read get_comments (2), pull_request_read get #28775 (body layout reference), pull_request_read get #29216 (draft, head, body read-back). No MCP write.",
      "api_writes": "2 — relay pr_create (fleet-write run 41422304266, PR #29216, 12807 bytes sent = stored, assignees none, no labels); this os-dev-report comment via post-stamped.mjs. git push x4 (not REST).",
      "open_questions": [
        {
          "question": "Should the auth counters count in the kernel's own in-memory cache stand-in (self-described degraded) when no cache plugin is registered?",
          "options": [
            "A (shipped): no. A degraded cache answers undefined; cache-less ObjectKernel deployments keep the bounded InProcessCounterStore and the one-shot no-shared-cache warning, exactly as today. Cost: none measured; one extra readServiceSelfInfo read per resolution.",
            "B: yes, count in any registered cache. Cost: every cache-less ObjectKernel deployment moves its counters off the bounded fallback for no cross-node gain, and the warning stops firing there."
          ],
          "recommendation": "A, because the stand-in is as process-local as the fallback, and only the fallback is bounded for these counters; A changes nothing for deployments without a real cache and binds every real one."
        },
        {
          "question": "The OTP send guard fix (otp-send-guard.ts) is a declared in-place fix; the claim's File surface parenthetical names the rate-limit store's increment and the cache resolution. Amend the claim?",
          "options": [
            "A: the seat amends the claim's File surface to name otp-send-guard.ts (same directory, same defect class, a reader the card names).",
            "B: split the OTP fix into its own card and PR."
          ],
          "recommendation": "A, because all four in-place conditions hold and the card's own reader list names the OTP budget."
        }
      ],
      "out_of_scope_findings": [
        "class: b · reach: named producer — the ADR-0069 D2 docblocks in rate-limit-storage.ts and secondary-storage.ts state the cross-node trade · ICacheService (packages/spec/src/contracts/cache-service.ts) declares get/set/delete/has/clear/stats and no atomic increment, so two nodes sharing one cache still read-modify-write; plumbing one is a spec contract change, not this lane · carrier: domain:server#5 (to route to the spec seat) · dedupe: ICacheService atomic increment, cache incr contract, cross-node rate limit",
        "class: a · reach: exception: security · sibling findings of this card's two rules outside its file surface, handed to the seat in the project session under the ruling's C half; no mechanism on this surface · carrier: domain:server#5"
      ],
      "files_changed": [
        ".changeset/29053-auth-counters-per-key.md",
        "packages/plugins/plugin-auth/src/auth-plugin.test.ts",
        "packages/plugins/plugin-auth/src/auth-plugin.ts",
        "packages/plugins/plugin-auth/src/kernel-cache.test.ts",
        "packages/plugins/plugin-auth/src/kernel-cache.ts",
        "packages/plugins/plugin-auth/src/otp-send-guard.ts",
        "packages/plugins/plugin-auth/src/per-key-serial.ts",
        "packages/plugins/plugin-auth/src/rate-limit-concurrency.test.ts",
        "packages/plugins/plugin-auth/src/rate-limit-storage.ts"
      ],
      "line_budget": "615 changed lines (+564 / -51) on 9 files at 7f52bb00 vs merge base (dispatch-gates reading; PR stats agree); no governed surface; under the 3000 human-merge threshold; tests 346 of the added lines",
      "deviations": [
        "The harness's post-PR step (MCP issue_write assignee + update_pull_request reviewer) was not run: the standard order forbids MCP writes and os-dev.md forbids PR assignees.",
        "The harness's PR-subscription posture was not taken: os-dev.md's dispatch contract overrides it; FAIL rounds come back through the seat.",
        "In-place fix outside the claim's parenthetical: OtpSendGuard.checkAndRecord (open question 2).",
        "Beyond the card's literal ask: the degraded stand-in rule (open question 1).",
        "PR body line 1-2 are the harness attribution block; Fixes #29053 follows them (os-dev.md exception).",
        "test:repo not run locally (no file of that project changed); it is CI's Test Core.",
        "Two gate prerequisites were met locally before their measured run: fetched the teardown-shape self-test's pinned commit; built ./packages/** for check:dual-build-cjs-loads."
      ]
    }

    Stamped 2026-11-02T09:40Z.


    Generated by Claude Code

  9. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 1 · card thread · file surface revised · 2026-11-02T09:42Z (supersedes 6572366493: adds otp-send-guard.ts, the dev's declared in-place fix of the same defect class)
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is session_01ADHkmPtGEJ1jqz6awM6fkJ
    Account: os-steve (the seat's linked user; the card's assignee)
    Branch: claude/project-thread-fk1k2s (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted on this card by triage 6571956503, verbatim 「A+C 同意」: domain:server fixes it from this card; the PR, changeset and records state the rule only, ⛔ no reproduction, probe or payload on any public surface.
    File surface: packages/plugins/plugin-auth/src/ (the rate-limit store's increment, the OTP send guard's per-number record (otp-send-guard.ts), the cache resolution in the auth plugin (new internal kernel-cache.ts, per-key-serial.ts), their tests), changeset; packages/core/src/ only if the cache must be resolved through an existing context API change (a new public PluginContext member is NOT in scope: it stops at needs_decision). ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is plugin-auth's fixed-window rate-limit store and its cache wiring · a counter admits more than its limit under concurrency in one process, and the shared store it was built to use is never reached · reached by every public sign-in page and the paid OTP budget of every deployment
    Thread-read: 6573903021
    Premise: holds (read at origin/main a4015ab47b: auth-plugin.ts still resolves the cache through an optional getServiceAsync the plugin context does not carry; the store's increment reads then writes across an await)
    Serial constraints cleared: no open PR touches packages/plugins/plugin-auth/** (file lists of the 55 open claude/ PRs read at claim time); auth-stack version-family overrides untouched.
    Resume-from: none — fresh from origin/main

    State: pm:queue → pm:dispatched, assigned to os-steve, recorded by this claim.

  10. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Landed · #29053 · 2026-11-02T10:51Z

    reading value
    PR #29216 MERGED by the merge queue at 2026-11-02T10:50:44Z, merge commit 5d3f82b013 (head 7f52bb00, ACCEPT 6573957152)
    this card closed completed by the PR's Fixes line

    State: pm:dispatched removed; the type, security, area and domain labels stay. Cross-node atomic increment (ICacheService, a packages/spec contract) stays out of scope as the PR's Acceptance notes state. Further work on this rule goes through the seat under the maintainer's ruling C.

  11. removed
    pm:dispatched
    on Nov 2, 2026
  12. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 5 · card thread · follow-up dispatch under ruling C (the same counter rule, beyond plugin-auth) · 2026-11-02T10:53Z
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is named in a follow-up claim once it reports its branch
    Account: os-steve (the seat's linked user)
    Branch: pending — the card thread's harness-pinned branch, written into a follow-up claim before the dev starts
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted by triage 6571942605, verbatim 「A+C 同意」: rule C dispatches a security finding through pm-dispatch and never files it as an issue, so this claim on the landed card is the dispatch's identity record; every public surface states the rule only.
    File surface: the remaining budget counters in the server lane: packages/runtime/src/security/ (the inbound limiter), packages/services/service-sms/src/ and packages/services/service-automation/src/builtin/ (their counters' cache resolution), packages/core/src/fallbacks/memory-cache.ts (the in-process fallback's bound), their tests, changesets. ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is the server lane's budget counters · the rule PR #29216 applied to plugin-auth (a counter holds its limit under concurrent requests, counts in the registered shared cache when one is registered per ADR-0069 D2, and its in-process fallback stays bounded) is applied to the lane's other counters · reached by every deployment that relies on those budgets
    Thread-read: 6575305919
    Premise: holds (read at origin/main after PR #29216 merged as 5d3f82b013; the rule's helpers live in plugin-auth only)
    Serial constraints cleared: the dev reads the open PRs touching these files right before opening its PR and merges origin/main again then.
    Resume-from: none — fresh from origin/main

    State: this card stays closed and unlabelled; the PR references it as Refs #29053.

  13. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 5 · card thread · follow-up dispatch under ruling C · branch named · 2026-11-02T10:55Z (supersedes 6575347342, which had the branch pending)
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is session_01ADHkmPcNztYJ49AQY8UaeN
    Account: os-steve (the seat's linked user)
    Branch: claude/project-thread-q99u6n (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted by triage 6571942605, verbatim 「A+C 同意」: rule C dispatches a security finding through pm-dispatch and never files it as an issue, so this claim on the landed card is the dispatch's identity record; every public surface states the rule only.
    File surface: the remaining budget counters in the server lane: packages/runtime/src/security/ (the inbound limiter), packages/services/service-sms/src/ and packages/services/service-automation/src/builtin/ (their counters' cache resolution), packages/core/src/fallbacks/memory-cache.ts (the in-process fallback's bound), their tests, changesets. ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is the server lane's budget counters · the rule PR #29216 applied to plugin-auth (a counter holds its limit under concurrent requests, counts in the registered shared cache when one is registered per ADR-0069 D2, and its in-process fallback stays bounded) is applied to the lane's other counters · reached by every deployment that relies on those budgets
    Thread-read: 6575347342
    Premise: holds (read at origin/main after PR #29216 merged as 5d3f82b013; the rule's helpers live in plugin-auth only)
    Serial constraints cleared: the dev reads the open PRs touching these files right before opening its PR and merges origin/main again then.
    Resume-from: none — fresh from origin/main

    State: this card stays closed and unlabelled; the PR references it as Refs #29053.

  14. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmPcNztYJ49AQY8UaeN
    os-dev-report

    {
      "issue": 29053,
      "status": "done",
      "branch": "claude/project-thread-q99u6n",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/29345",
      "session": "session_01ADHkmPcNztYJ49AQY8UaeN",
      "premise_still_valid": true,
      "summary": "The #29216 counter rule now holds for the server lane's other budget counters: the runtime token bucket (server-level inbound limiter and declared endpoint budgets) orders the updates of one key in-process; the runtime limiters, the daily SMS send quota and the notify node's per-address email-field limit resolve the cache so that a value or factory registration is counted in and the kernel's degraded stand-in is not; the core in-memory cache fallback evicts expired entries on write and stays bounded by its live entries. The two helpers are package-local copies of plugin-auth's internal ones (seat's decision), not re-exported. PR body and this report state the rule only (ruling C); mechanism readings went to the seat privately.",
      "tests": "On edc9e043 under the verify lock: build of the four packages and their dependencies exit 0; pnpm --filter PKG test: core 130 files / 2912 passed; service-sms 8 / 109; service-automation 260 / 3337; runtime 518 files, 8346 passed, 19 skipped. typecheck exit 0 for core, service-sms, service-automation; runtime exit 0 after the optional driver-turso dist was built (first read was that missing prerequisite). On a7dd43d1 the notify pin 2 passed; on 0c0c6185 service-sms test 8/109 and typecheck exit 0. New pins: runtime concurrency (6), runtime kernel-cache (7), composed dispatcher on ObjectKernel (2), SMS quota cache (2), notify cache (2), core memory-cache bound (3). Ablations: 8, each via scripts/ablation-replace.mjs, anchor hit once, blob changed, restored to the HEAD blob with git diff HEAD empty; every one turned its pins red (failure output given to the seat privately).",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack on 0c0c6185: 70 derived (18 paths, 1005 changed lines); all 70 run, stdin /dev/null, exit captured before any pipe: 70 exit 0. --ran on 0c0c6185: 70 derived, 70 run, 0 NOT-MEASURED, 0 UNRUN (derived zero). On a7dd43d1/edc9e043 check:engine-double-contract and check:test-source-alias first read exit 1 and were fixed (findOne routed through assertEngineFindOnePredicate plus --write ledger row; service-sms vitest aliases instead of widening the registry); check:dual-build-cjs-loads first read exit 3 and exit 0 after turbo build ./packages/**. Lint: eslint --no-inline-config over packages/runtime, packages/core, service-sms, service-automation on edc9e043 exit 0; service-sms again on 0c0c6185 exit 0. CI check-runs: not read at report time.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "3 — all reads: issue_read get_comments #29053 (1), list_pull_requests open (1), pull_request_read get #29345 (1, draft/head/body read-back). No MCP write.",
      "api_writes": "2 — relay pr_create (fleet-write run 41445337498, PR #29345, 11493 bytes sent = stored, no assignees, no labels); this os-dev-report comment via post-stamped.mjs. git push x5 (not REST).",
      "open_questions": [
        {
          "question": "Should the runtime limiters count in the kernel's own in-memory cache stand-in (self-described degraded) when no cache plugin is registered?",
          "options": [
            "A (shipped, same as #29216): no. Cache-less ObjectKernel deployments' runtime buckets use the bounded per-process fallback and its one-shot no-shared-cache warning now fires. Cost: none measured.",
            "B: keep counting in the stand-in. Cost: the warning stays silent on a deployment with no shared store, and the buckets live in a cache the counters do not bound themselves (now bounded by this PR's sweep)."
          ],
          "recommendation": "A, because it is the rule #29216 set and the stand-in is as process-local as the fallback."
        },
        {
          "question": "Four files fall outside the claim's File surface: packages/runtime/src/dispatcher-plugin.ts (the two resolveCache wirings), packages/runtime/src/dispatcher-plugin.rate-limit-cache.integration.test.ts (its pin), packages/services/service-sms/vitest.config.ts (forced by check:test-source-alias) and scripts/engine-double-contract.pinned.json (forced by check:engine-double-contract --write). Amend the claim?",
          "options": [
            "A: the seat amends the File surface to name them (the wiring is the runtime counters' reader; the other two are gate-forced).",
            "B: split the dispatcher wiring into its own PR."
          ],
          "recommendation": "A, because without the wiring change the runtime half of the cache rule is not applied, and the other two are gate repairs of this PR's own tests."
        }
      ],
      "security_findings": "withheld",
      "out_of_scope_findings": [
        "class: b · reach: named producer — ICacheService (packages/spec/src/contracts/cache-service.ts) declares no atomic increment, so two nodes sharing one cache still read-modify-write; a spec contract change, not this lane · carrier: domain:server#5 (already routed with #29216) · dedupe: ICacheService atomic increment, cache incr contract, cross-node rate limit",
        "observation · core createMemoryCache().has() answers true for an expired entry no read or sweep has dropped yet; not a counter path, no reader measured · carrier: none · noted, not filed"
      ],
      "files_changed": [
        ".changeset/29053-server-budget-counters.md",
        "packages/core/src/fallbacks/memory-cache-bound.test.ts",
        "packages/core/src/fallbacks/memory-cache.ts",
        "packages/runtime/src/dispatcher-plugin.rate-limit-cache.integration.test.ts",
        "packages/runtime/src/dispatcher-plugin.ts",
        "packages/runtime/src/security/inbound-rate-limit-concurrency.test.ts",
        "packages/runtime/src/security/inbound-rate-limit.ts",
        "packages/runtime/src/security/kernel-cache.test.ts",
        "packages/runtime/src/security/kernel-cache.ts",
        "packages/runtime/src/security/per-key-serial.ts",
        "packages/services/service-automation/src/builtin/kernel-cache.ts",
        "packages/services/service-automation/src/builtin/notify-email-field-cache.integration.test.ts",
        "packages/services/service-automation/src/builtin/notify-node.ts",
        "packages/services/service-sms/src/kernel-cache.ts",
        "packages/services/service-sms/src/sms-daily-quota-cache.test.ts",
        "packages/services/service-sms/src/sms-plugin.ts",
        "packages/services/service-sms/vitest.config.ts",
        "scripts/engine-double-contract.pinned.json"
      ],
      "line_budget": "1005 changed lines (+962 / -43) on 18 files at 0c0c6185 vs merge base (dispatch-gates reading; PR stats agree); 633 of the added lines are tests; no governed surface; under the 3000 human-merge threshold",
      "deviations": [
        "Helper sharing: proposed re-exporting plugin-auth's two internal helpers; on the seat's ruling (no new exports) shipped package-local copies instead: per-key-serial.ts in runtime, kernel-cache.ts in runtime, service-sms and service-automation. Named in the PR body.",
        "Files outside the claim's File surface (open question 2): dispatcher-plugin.ts, its new integration pin, service-sms/vitest.config.ts, scripts/engine-double-contract.pinned.json.",
        "The notify cache pin runs its sends one at a time: concurrent engine.execute calls of one flow for one record do not all reach the node in that harness; the counter's own concurrency rule is plugin-auth's serialised incrementFixedWindow, pinned by #29216.",
        "The harness's post-PR step (MCP issue_write assignee + update_pull_request reviewer) was not run: the standard order forbids MCP writes and os-dev.md forbids PR assignees. The harness's PR-subscription posture was not taken (os-dev.md overrides it).",
        "PR body lines 1-2 are the harness attribution block; Refs #29053 follows them (no guard refused Refs).",
        "test:repo not run locally (no file of that project changed); it is CI's Test Core.",
        "Gate prerequisites met before the measured run: fetched the teardown-shape self-test's pinned commit; built ./packages/** for check:dual-build-cjs-loads and for runtime's typecheck (driver-turso dist)."
      ]
    }

    Stamped 2026-11-02T12:32Z.


    Generated by Claude Code

  15. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Claim: PM loop round 5 · card thread · follow-up dispatch under ruling C · file surface revised · 2026-11-02T12:34Z (supersedes 6575380860: adds the runtime counters' cache wiring in the dispatcher and two gate-forced files, per the dev's report 6577250291)
    Session: session_01ADHkmQKwKFCp1m6Pb6Q8c1 (the seat); the card thread is session_01ADHkmPcNztYJ49AQY8UaeN
    Account: os-steve (the seat's linked user)
    Branch: claude/project-thread-q99u6n (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#5
    Ruling-ref: the maintainer's ruling quoted by triage 6571942605, verbatim 「A+C 同意」: rule C dispatches a security finding through pm-dispatch and never files it as an issue, so this claim on the landed card is the dispatch's identity record; every public surface states the rule only.
    File surface: the remaining budget counters in the server lane: packages/runtime/src/security/ (the inbound limiter), packages/services/service-sms/src/ and packages/services/service-automation/src/builtin/ (their counters' cache resolution), packages/core/src/fallbacks/memory-cache.ts (the in-process fallback's bound), the dispatcher's two resolveCache wirings in packages/runtime/src/dispatcher-plugin.ts (the runtime counters' reader) and their integration pin, the gate-forced packages/services/service-sms/vitest.config.ts (check:test-source-alias) and scripts/engine-double-contract.pinned.json (check:engine-double-contract --write), their tests, changesets. ⛔ No packages/spec/**.
    Container & model: M, mode:thread, model: the thread's default judgement tier, effort: xhigh (security)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the code is the server lane's budget counters · the rule PR #29216 applied to plugin-auth (a counter holds its limit under concurrent requests, counts in the registered shared cache when one is registered per ADR-0069 D2, and its in-process fallback stays bounded) is applied to the lane's other counters · reached by every deployment that relies on those budgets
    Thread-read: 6577250291
    Premise: holds (read at origin/main after PR #29216 merged as 5d3f82b013; the rule's helpers live in plugin-auth only)
    Serial constraints cleared: the dev reads the open PRs touching these files right before opening its PR and merges origin/main again then.
    Resume-from: none — fresh from origin/main

    State: this card stays closed and unlabelled; the PR references it as Refs #29053.

  16. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

    Landed · follow-up under ruling C (claim 6577282409) · 2026-11-02T13:57Z

    reading value
    PR #29345 MERGED by the merge queue at 2026-11-02T13:49:50Z, merge commit 85f7a0d991 (head 7789dab046, ACCEPT 6577475970)
    this card stays closed; the PR referenced it with Refs

    The rule now holds for the server lane's remaining budget counters. This follow-up dispatch is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:identitybugdomain:serverpriority:p2security

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions