openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

fix(composio): log daily budget reset

Open sunilkumarvalmiki opened this issue 6 months ago • 1 comments

Summary

  • Add an explicit Composio sync-state log when the daily request budget rolls over to a new UTC day.
  • Include the old date, new date, previous request count, and limit so operators can tell budget exhaustion recovered.
  • Keep provider behavior unchanged: stale budgets still reset before the new request count is recorded.

Problem

  • #2437 item G notes that providers log when the daily request budget is exhausted, but there is no matching reset/resume log when the date changes.
  • Without that rollover signal, support logs can make it unclear whether sync resumed on the next day or remained stuck behind a stale budget state.

Solution

  • Emit a non-sensitive tracing::info! event from DailyBudget::record_requests when the stored budget date differs from the current UTC date.
  • Reuse the existing reset branch, so the existing date-rollover unit coverage exercises the changed line.
  • Do not change the budget math, limits, persistence format, or provider scheduling.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — existing stale-date regression test covers the rollover branch.
  • [x] Diff coverage >= 80% — changed lines are covered by daily_budget_resets_on_date_change; CI will run the full diff-cover gate.
  • [x] Coverage matrix updated — N/A: behavior-only observability change, no feature row added or renamed.
  • [x] All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no feature matrix row.
  • [x] No new external network dependencies introduced (mock backend used per Testing Strategy).
  • [x] Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: no release-cut surface touched.
  • [x] Linked issue closed via Closes #NNN in the ## Related section — N/A: this addresses only #2437 item G; the broader triage issue should stay open.

Impact

  • Runtime/platform: Rust core Composio memory-sync state only.
  • Performance: negligible; one log event only when a stale budget rolls over to a new UTC day.
  • Security/privacy: log fields are dates and counters only; no connection ids, item ids, tokens, or user content are emitted.
  • Compatibility: no state schema, API, scheduling, or provider behavior changes.

Related

  • Refs #2437 (item G only)
  • Follow-up PR(s)/TODOs: broader #2437 items A-F remain separate triage/design work.

AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: sunil/2437-composio-budget-reset-log
  • Commit SHA: 575e852207e939e58edb94f19a4dba753183c1fb

Validation Run

  • [x] pnpm --filter openhuman-app format:check — N/A: no app files changed.
  • [x] pnpm typecheck — N/A: no TypeScript files changed.
  • [x] Focused tests: cargo test --manifest-path Cargo.toml --lib sync_state::tests — 13 passed.
  • [x] Rust fmt/check (if changed): cargo fmt --manifest-path Cargo.toml --check — passed.
  • [x] Tauri fmt/check (if changed): N/A: no Tauri shell files changed.

Validation Blocked

  • command: cargo test --manifest-path Cargo.toml memory_sync::composio::providers::sync_state::tests::daily_budget_resets_on_date_change -- --exact
  • error: Without --lib, Cargo compiled unrelated bins/integration tests and hit pre-existing crate/linkage issues such as can't find crate for openhuman_core, found possibly newer version of crate windows_sys, and crate hound required to be available in rlib format.
  • impact: The focused library tests for the changed module pass; the blocked command did not reach this PR's test surface and is unrelated to the one-line observability change.

Behavior Changes

  • Intended behavior change: stale Composio daily budgets now emit an info log before they reset.
  • User-visible effect: support/debug logs now show when a budget exhausted on a previous UTC day becomes available again.

Parity Contract

  • Legacy behavior preserved: date rollover still resets requests_used to zero before recording the new request count.
  • Guard/fallback/dispatch parity checks: no provider dispatch, rate limit math, budget limit, or persistence schema changes.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none found for #2437 item G.
  • Canonical PR: this PR.
  • Resolution (closed/superseded/updated): N/A.

Summary by CodeRabbit

  • Chores
    • Added informational logging for daily request budget reset tracking to improve system observability.

Review Change Stack

sunilkumarvalmiki avatar May 26 '26 09:05 sunilkumarvalmiki

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b3ae4e18-75ea-4c96-8564-b2b313c1e196

📥 Commits

Reviewing files that changed from the base of the PR and between de2a78a7662a68a5644d982c46ecc44102f83660 and 575e852207e939e58edb94f19a4dba753183c1fb.

📒 Files selected for processing (1)
  • src/openhuman/memory_sync/composio/providers/sync_state.rs

📝 Walkthrough

Walkthrough

This PR adds a single informational tracing log that fires when the daily request budget rolls over to a new UTC date, capturing the date transition and current budget state for debugging and monitoring purposes.

Changes

Daily Budget Rollover Logging

Layer / File(s) Summary
Daily budget rollover logging
src/openhuman/memory_sync/composio/providers/sync_state.rs
A tracing::info! message is emitted when DailyBudget::record_requests detects the stored calendar date has become stale and resets counters for the new date, including old/new dates and budget state.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops through budget days, Tracking time in telemetry ways, When dawn's light rolls the counters new, A log message captures what's true. 🐰📝

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding logging when the daily budget resets on date rollover in the Composio provider.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 26 '26 09:05 coderabbitai[bot]

@sunilkumarvalmiki CI checks (required) failing;

graycyrus avatar May 28 '26 13:05 graycyrus