Skip to content

agents: own Llama cleanup tasks - #937

Merged
yisding merged 1 commit into
agent/ws25-retire-server-timeout-ledgerfrom
agent/ws26-llama-cleanup-scope
Aug 7, 2026
Merged

agents: own Llama cleanup tasks#937
yisding merged 1 commit into
agent/ws25-retire-server-timeout-ledgerfrom
agent/ws26-llama-cleanup-scope

Conversation

@yisding

@yisding yisding commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

LlamaAgentsBridge kept synchronous-reset cleanup in a hand-managed task set and created bounded handler-cancel work with asyncio.ensure_future. The former duplicated scope bookkeeping; the latter could survive its deadline without a bridge-local owner.

Changes

  • add separate named task scopes for reset cleanup and bounded handler cancellation
  • route local handler, local stream, and remote handler reset work through stable task identities
  • retain bounded cancel survivors without making aclose() wait past their deadline
  • join and release reset cleanup ownership from aclose()
  • add a hard-timeout survivor ownership regression
  • update local and remote reset tests to assert named scope membership
  • reduce the raw production task baseline from 22 to 20
  • document bridge cleanup ownership

Why / impact

Reset and cancellation behavior stay best-effort and keep the same timeout. Cleanup work is now explicitly attached to the bridge, while the two scopes preserve the important distinction between reset work that aclose() must join and cancellation work that may outlive the bounded wait.

Checks

  • .venv/bin/python -m pytest tests/integrations/agents/test_llama_agents_bridge_cancellation.py tests/integrations/agents/test_llama_agents_bridge_local.py tests/integrations/agents/test_llama_agents_bridge_remote.py -q (45 passed)
  • .venv/bin/python -m pytest tests/integrations/agents -k 'llama or lifecycle_credential_free' -q (66 passed, 2 skipped)
  • .venv/bin/python -m pytest tests/ratchets/test_source_inventory.py tests/ratchets/test_teardown_budget_inventory.py -q (16 passed)
  • focused Ruff and mypy checks
  • pre-commit hooks

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d6db6849-788f-4ff4-8821-acd992dba94f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@yisding
yisding marked this pull request as ready for review August 7, 2026 02:45
@yisding
yisding force-pushed the agent/ws26-llama-cleanup-scope branch from 25ee20e to fd67749 Compare August 7, 2026 03:20
@yisding
yisding force-pushed the agent/ws26-llama-cleanup-scope branch from fd67749 to 6495437 Compare August 7, 2026 03:49
@yisding
yisding merged commit bc36a53 into agent/ws25-voice-server-listener-scope Aug 7, 2026
2 checks passed
@yisding
yisding deleted the agent/ws26-llama-cleanup-scope branch August 7, 2026 04:11
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.

1 participant