Skip to content

feat: harden fork sync lane health - #7

Merged
yansigit merged 11 commits into
mainfrom
feat/fork-sync-lane-health
Aug 22, 2026
Merged

yansigit merged 11 commits into
mainfrom
feat/fork-sync-lane-health

Conversation

@yansigit

@yansigit yansigit commented Aug 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add main-behind and history-diverged lane kinds with containment and merge-base metadata so a successful pin can wake the coordinator when fork main still lacks the vendor commit.
  • Treat zero merge bases as disconnected history and fail closed to history-diverged with recommendedLane: emergency-rebuild; only exactly one common ancestor may use daily-merge or noop lanes.
  • Add the fork-owned main pull-request mergeability/descendant check and document daily merge-from-main coordination; disconnected run/main rebuilds remain emergency-only for history-diverged events.
  • Fix CLI annotation to capture the default-branch HEAD before pinning, because pinning switches HEAD through vendor/main and vendor/dev.

Verification

  • bun test tests/fork/ — 77 passed, 0 failed across 12 files.
  • bun run typecheck — passed (bun x tsc --noEmit).
  • Focused red-green regression tests cover zero-merge-base classification in the lane classifier and wired CLI.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults; the workflow uses immutable checkout, read-only contents permission, no pull-request write permission, and no secret exposure.

Made with Cursor

yansigit and others added 8 commits August 22, 2026 14:31
Validate fork sync pull requests for GitHub mergeability and base ancestry without granting repository mutation permissions.

Co-authored-by: Cursor <[email protected]>
Add the locked lane classification contract and focused tests while keeping CLI wiring for the next wave.

Co-authored-by: Cursor <[email protected]>
Keep actionable lane events on the notification path and expose their lane in the workflow summary.

Co-authored-by: Cursor <[email protected]>
Post actionable lane events to webhooks and tell issue responders when to open a merge-from-main draft PR.

Co-authored-by: Cursor <[email protected]>
Classify main-lane state after detect and pin, with CLI regression coverage for daily, noop, emergency, and unchanged outcomes.

Co-authored-by: Cursor <[email protected]>
Pinning switches HEAD through vendor/main and vendor/dev, so capture the default-branch SHA before pinning and pass it to main-lane annotation. Keep the workflow checkout and contract tests aligned with the review fix.

Co-authored-by: Cursor <[email protected]>
Document the main-behind and history-diverged event lanes, daily merge-from-main coordinator flow, mergeability gate, and contained overlay replay rules. Keep disconnected run/main rebuilds emergency-only and reserve the final merge commit for a human.

Co-authored-by: Cursor <[email protected]>
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 22, 2026
yansigit and others added 3 commits August 22, 2026 14:57
Keep vendor refs publishable when lane annotation detects history divergence, wake every configured coordinator for actionable lanes, and reserve rebuild guidance for the emergency path.

Co-authored-by: Cursor <[email protected]>
Keep uncontained already-current events visible to the fork issue notifier while preserving the contained no-op lane.

Co-authored-by: Cursor <[email protected]>
Classify zero merge bases as history-diverged so disconnected histories use the emergency rebuild lane instead of being treated as already current.

Co-authored-by: Cursor <[email protected]>
@yansigit
yansigit marked this pull request as ready for review August 22, 2026 21:02
@yansigit
yansigit merged commit 07aa14a into main Aug 22, 2026
25 of 26 checks passed
@yansigit
yansigit deleted the feat/fork-sync-lane-health branch August 22, 2026 21:29
cursor Bot pushed a commit that referenced this pull request Oct 12, 2026
…ge-jun#6090) (lidge-jun#6173)

* feat(quota): report Devin account quota from GetUserStatus

Devin accounts had no quota row, so headroom-based account ranking had
nothing to order them by. Probe Cognition's unary
SeatManagementService/GetUserStatus with the default cloud-direct
Metadata, against the credential's allowlisted api-server host with
redirects refused and no response body echoed.

Only dated daily/weekly windows the plan does not hide are published:
credit-billed plans leave those percents at a zero default that would
read as exhausted. Prompt plus flex credits form one monthly pool
measured against the server balance; a negative balance is unlimited.
4xx other than 408/429 is terminal; a decoded status with nothing
measurable is authoritative-empty.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit b493e0d)

* fix(quota): tighten Devin quota mapping and failure handling

- Publish the credit pool only for credit-billed plans (or an unknown
  strategy with no dated window); a quota-billed plan with a zero credit
  balance no longer reads monthly-exhausted.
- Drop dated windows whose reset is not after now.
- Read the body through the bounded byte reader and decode inside the
  try, so a truncated or oversized body keeps last-good instead of
  throwing.
- Treat 409 and 499 as retryable alongside 408 and 429.
- Cover flow credits (#5/#9/#13), hide_weekly (#37), and 403/404/429.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 7d12eb1)

* fix(quota): reject truncated Devin quota protobufs and document the probe

- Require the decoded fields to account for every byte. iterFields stops
  quietly at a truncated length-delimited field, so half a response decoded
  to an empty status and was published as authoritative-empty, deleting the
  last-good row.
- Use the Web Crypto randomUUID instead of node:crypto.
- List Devin in the per-account quota section of the CLI accounts reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit a71f149)

* fix(quota): stop flow credits gating Devin accounts; key the cache by tenant host

- Flow credits are decoded but no longer published. They meter agent tool
  actions, not chat turns, and ranking reads the fullest custom window as
  the account's limit, so an empty flow balance retired accounts that could
  still serve.
- A credit-billed plan with nothing used and nothing left reads 100%
  instead of unmeasured, so ranking no longer prefers it as untested.
- The account quota identity includes the credential's own api base URL
  when it has one, so a tenant host change invalidates the cached reading.
  Credentials without one keep their existing key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 9e23686)

* fix(quota): reject a Devin status with no plan or a malformed plan-end timestamp

- A present plan-end timestamp that fails to decode now fails the whole
  status instead of reading as absent, so a malformed response keeps the
  last-good row rather than publishing an authoritative-empty one.
- A status with neither the top-level PlanInfo nor the nested PlanStatus
  plan is rejected instead of decoded into a zero-valued plan, which could
  read as a credit-billed account with every credit spent.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 52d9b62)

* fix(devin): reject malformed quota statuses and preserve last-good

Validate known protobuf wire types and 64-bit varint bounds before quota mapping. Require observed prompt balances for a monthly window, treat only credential rejection as terminal, and scope tenant host cache identity to Devin. Update the provider contract and regression coverage.

Co-authored-by: Sayo <[email protected]>

* fix(quota): count a lone Devin balance field as credit evidence

GetUserStatus is proto3, which omits zero-valued fields, so an exhausted pool
arrives with used_prompt and no available_prompt. Requiring both fields hid
that account's 100% monthly window and ranked it as untested headroom. Any of
the four pooled balance fields (#4, #6, #7, #8) is now evidence; only a status
with none of them publishes no credit window.

Co-authored-by: Sayo <[email protected]>

* fix(quota): keep last-good Devin quota on a GetUserStatus 403

A 403 from GetUserStatus can forbid that one RPC for a key that still serves
chat, so treating it as a rejected credential cleared a usable account's
quota. Only 401 is terminal now. The structure and CLI reference describe the
balance-evidence rule as shipped: any one of the pooled balance fields counts.

Co-authored-by: Sayo <[email protected]>

* fix(quota): honor configured Devin tenant for legacy credentials

Co-authored-by: Sayo <[email protected]>

* fix(quota): keep expired Devin windows out of credit fallback

Co-authored-by: Sayo <[email protected]>

* fix(quota): enforce one Devin probe deadline

Co-authored-by: Sayo <[email protected]>

* fix(quota): reject negative Devin used credits

Co-authored-by: Sayo <[email protected]>

---------

Co-authored-by: Sayo <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant