Skip to content

fix(livekit): bound memory background task steps - #1924

Open
zhanba wants to merge 5 commits into
mainfrom
fix/background-task-max-steps
Open

fix(livekit): bound memory background task steps#1924
zhanba wants to merge 5 commits into
mainfrom
fix/background-task-max-steps

Conversation

@zhanba

@zhanba zhanba commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • allow forked background tasks to persist a task-specific maximum step count
  • cap task memory at 3 steps, auto memory extraction at 5, and auto memory dream consolidation at 20
  • retain the existing 50-step fallback for background tasks without an explicit limit

Test plan

  • Run targeted LiveKit Vitest suites (22 tests)
  • Run bun check
  • Run bun tsc
  • Run git diff --check

🤖 Generated with Pochi | Task

@codecov-commenter

codecov-commenter commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.32%. Comparing base (ab3dc4d) to head (0b35846).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #1924    +/-   ##
========================================
  Coverage   33.32%   33.32%            
========================================
  Files         778      778            
  Lines       83120    83119     -1     
  Branches     4897     4734   -163     
========================================
+ Hits        27696    27697     +1     
+ Misses      55304    55302     -2     
  Partials      120      120            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Allow forked background tasks to define task-specific step limits so memory workflows stop before consuming the generic 50-step budget.

🤖 Generated with [Pochi](https://getpochi.com) | [Task](https://app.getpochi.com/share/p-756b25d05481454296b52ae4fcf65ad7)

Co-Authored-By: Pochi <noreply@getpochi.com>
@zhanba
zhanba force-pushed the fix/background-task-max-steps branch from 8d9cad5 to 565180d Compare August 31, 2026 12:33
zhanba and others added 4 commits September 1, 2026 20:08
Task memory extracted on warm-up, again on a token-increment rule, and once
more synchronously right before compaction. That burned background forks and
shortened the verbatim tail compaction is supposed to preserve, since the tail
is whatever sits between the extraction boundary and the compaction point.

Extract once when the context reaches 80% of the auto-compact threshold, mark
the cycle done on success, and reset the flag when compaction finishes. Only
failed attempts retry, capped at two per cycle, so a stale boundary cannot
push compaction into its degraded attach path. Compaction no longer triggers
an extraction itself and only waits up to 5s for an in-flight one to settle.

🤖 Generated with [Pochi](https://getpochi.com) | [Task](https://app.getpochi.com/share/p-8a63e58579ce42a1a32c7848ee4f84e9)

Co-Authored-By: Pochi <noreply@getpochi.com>
Auto-memory forked a full-context extraction agent at every completed
turn, and judged success by attemptCompletion alone — so a systematically
failing extraction never advanced the watermark and re-ran on every later
turn. Require three new user turns before extracting, and treat a
successful write by the fork as success while advancing the watermark
even on failure.

🤖 Generated with [Pochi](https://getpochi.com) | [Task](https://app.getpochi.com/share/p-8a63e58579ce42a1a32c7848ee4f84e9)

Co-Authored-By: Pochi <noreply@getpochi.com>
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.

2 participants