Skip to content

Stop reconciliation GraphQL spending after an observed reserve hold - #235

Merged
Nitjsefnie merged 1 commit into
mainfrom
issue-229-graphql-reserve
Sep 8, 2026
Merged

Stop reconciliation GraphQL spending after an observed reserve hold#235
Nitjsefnie merged 1 commit into
mainfrom
issue-229-graphql-reserve

Conversation

@Nitjsefnie

@Nitjsefnie Nitjsefnie commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Stop an admitted reconciliation from starting more GraphQL requests after its sponsor's observed balance falls below the reserve. A held crawl skips materialization and defers its queue row to the observed reset deadline without consuming an attempt.

Related Issues and Pull Requests

Fixes #229

Changes

  • Check the existing sponsor budget immediately before GraphQL transport and after successful observations, including the final page.
  • Keep a reconciliation-scoped hold latched across concurrent collectors and reset expiry; ordinary owned gateway calls outside the crawl remain available.
  • Settle started runs as incomplete and return the existing budget-held result, preserving worker deferral and attempt refunds.
  • Add transport, concurrency, observer-failure, and worker regression coverage while retaining all six operations and the existing reserve equality/expiry behavior.

Testing

  • RED tests reproduced extra issue-page requests and final-page materialization after a low observation. Disabling both transport checks caused four targeted failures; removing only the pre-request check exposed an extra GraphQL request; clearing the latch produced twelve requests instead of six; and routing the typed hold through generic error handling returned RETRY_SCHEDULED instead of BUDGET_HELD. Each mutant was restored and its focused tests returned green.
  • Focused verification passed seven files and 448 tests.
  • pnpm db:migrate && pnpm test --run && pnpm lint && pnpm typecheck && pnpm build passed in implementation and again in the independent final review: 118 files and 2,712 tests passed with zero skips; lint, typecheck, and production build passed.
  • GitHub CI passed both verify and actionlint on exact head 40b792fabddcb47ddac3088b76ac19d4e520f8f2.
  • Output findings: three existing Edge Runtime node:crypto build warnings in untouched modules; pnpm warned that four dependency build scripts were ignored; migration emitted existing-object notices.

Follow-ups / Known Limitations

Requests already active when the hold is observed may settle and spend points; this does not guarantee an absolute global balance floor. Held retries restart collection rather than resuming a cursor. A held run uses the existing FAILED run status while its queue row is deferred with its attempt refunded.

Footer

Generated by GPT-5.6 Sol (brief, orchestration), GPT-6 Astra (discovery, implementation, testing, verification, review, scoring)

Latch the existing sponsor budget assessment across concurrent crawl collectors, and defer held jobs without materializing or consuming a queue attempt.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
@Nitjsefnie
Nitjsefnie marked this pull request as ready for review September 8, 2026 08:13
@Nitjsefnie
Nitjsefnie merged commit a8a4196 into main Sep 8, 2026
2 checks passed
@Nitjsefnie
Nitjsefnie deleted the issue-229-graphql-reserve branch September 8, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The GraphQL reserve admits a pass but does not bound it, so one fold can still spend past zero

1 participant