Skip to content

fix(rees): return degraded history before caller timeout - #1805

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-rees-timeout-context
Jun 30, 2026
Merged

fix(rees): return degraded history before caller timeout#1805
JSONbored merged 1 commit into
mainfrom
codex/fix-rees-timeout-context

Conversation

@JSONbored

@JSONbored JSONbored commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes the REES timeout budget mismatch by sending an analyzer budget below the engine HTTP timeout, so REES can return a degraded brief before the caller aborts.
  • Makes the history analyzer budget-aware with bounded fanout, per-GitHub-subcall aborts, lookup caps, and partial status instead of a generic timeout.
  • Expands safe Sentry attribution for REES degradations with analyzer, request, budget, elapsed, phase/subcall, endpoint category, and bounded lookup-count context.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

This is scoped to the production REES timeout path surfaced by Sentry issue GITTENSORY-T; no separate GitHub issue is linked.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires >=97% coverage of the lines AND branches you changed (aim for 98%+ on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Also ran focused checks:

  • npm --prefix review-enrichment test
  • npx vitest run test/unit/enrichment-wire.test.ts

If any required check was skipped, explain why:

  • None. npm run test:ci completed successfully and covers the listed local gate commands except audit; audit was run separately.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

No auth, cookie, CORS, GitHub App, Cloudflare, session, or visible UI behavior changed. REES Sentry context tests cover sanitizer boundaries for sensitive payload fields.

UI Evidence

Not applicable. This changes backend REES behavior, the engine REES caller, tests, and non-visual REES deployment notes only.

State / title JPG/PNG evidence
Not applicable No visible UI change

Notes

Railway deployment note: deploy the updated review-enrichment service before relying on the new default behavior. After deployment, the engine default REES_TIMEOUT_MS=8000 sends a budget.timeoutMs of 7000, giving REES one second of headroom to return partial analyzer status. Until the Railway service is updated, temporarily raise the engine-side REES_TIMEOUT_MS above the old REES analyzer budget or set REES_ANALYZERS to a bounded list that excludes history.

Sentry setup note: keep SENTRY_DSN, release/source-map settings, and Railway-provided release metadata configured through Railway environment variables. Do not print or commit any secret values.

@loopover-orb

loopover-orb Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-06-30 02:49:20 UTC

10 files · 1 AI reviewer · no blockers · readiness 86/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The change correctly threads a smaller engine-supplied analyzer budget into REES, teaches the history analyzer to stop GitHub fanout before the caller timeout, and carries bounded degradation diagnostics into Sentry. The timeout path is fail-open: timed-out analyzers are marked degraded, partial history findings still render, and the engine accepts degraded briefs instead of discarding them. I do not see a reachable correctness break in the provided diff, but there are a few maintainability and documentation follow-ups around stale docs and unused budget fields.

Nits — 5 non-blocking
  • nit: review-enrichment/src/analyzers/history.ts:44 carries `timeoutMs` through `ScanOptions`, and review-enrichment/src/brief.ts:73 passes it, but the history analyzer never reads it, so remove it or use it for diagnostics to avoid a misleading contract.
  • nit: review-enrichment/README.md:45 says the analyzer budget has one second of headroom below `REES_TIMEOUT_MS`, but `resolveReesAnalyzerBudgetMs(1000)` returns 500ms, so document the minimum-budget exception.
  • nit: apps/gittensory-ui/src/routes/docs.self-hosting-rees-analyzers.tsx still describes only `codeowners` and `assetWeight` as GitHub API analyzers, so the self-hosted UI docs need the same analyzer/network model update as the README.
  • Update the UI REES analyzer docs/network grouping alongside `src/review/enrichment-wire.ts` so `commitSignature`, `history`, `iacMisconfig`, and `nativeBuild` are documented wherever operators discover analyzer names.
  • Either remove `ScanOptions.timeoutMs` / `AnalyzerRunContext.startedAtMs` until a caller uses them, or include them in the captured diagnostics so the new context fields earn their keep.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (size label size:XL; no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 2 registered-repo PR(s), 2 merged, 263 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 2 PR(s), 263 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 2 PR(s), 263 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Triage stale or unlinked PRs.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jun 30, 2026
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.61%. Comparing base (9d05cb6) to head (d9a2e18).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1805   +/-   ##
=======================================
  Coverage   95.61%   95.61%           
=======================================
  Files         214      214           
  Lines       23233    23249   +16     
  Branches     8393     8398    +5     
=======================================
+ Hits        22214    22230   +16     
  Misses        422      422           
  Partials      597      597           
Files with missing lines Coverage Δ
src/review/enrichment-wire.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored marked this pull request as ready for review June 30, 2026 02:50
@JSONbored JSONbored self-assigned this Jun 30, 2026
@dosubot dosubot Bot added the size:XL label Jun 30, 2026
@JSONbored
JSONbored merged commit fb4ea29 into main Jun 30, 2026
20 checks passed
@JSONbored
JSONbored deleted the codex/fix-rees-timeout-context branch June 30, 2026 02:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant