Skip to content

Finalize alternating managed-tool read loops before round cap #53

Description

@mostlydev

Problem\n\ncllama suppresses exact duplicate managed calls and finalizes after a configurable consecutive duplicate streak. The streak resets when an agent alternates between two already-seen successful read calls. A live Tiverton turn on 2026-08-13 alternated trading-api.get_trade and trading-api.get_desk_risk_context after the trade was already terminal. Each call was replayed as a duplicate, but duplicate_streak stayed at 1, so the turn ran to the 20-round managed-tool budget and accumulated ~1.55M prompt tokens.\n\n## Desired behavior\n\nDetect bounded repeating cycles of duplicate, replayed, non-mutating managed tool calls (at least ABAB) and force finalization before the hard round cap. Preserve legitimate workflows where calls change arguments, return fresh uncached results, or involve ambiguous mutations. Emit explicit telemetry and session-history metadata for the cycle intervention.\n\n## Constraints\n\n- Apply to both OpenAI and Anthropic managed loops.\n- Reuse canonical managed-call signatures.\n- Do not lower the global max-rounds setting.\n- Do not suppress first execution of any call.\n- Keep existing same-signature duplicate-streak behavior intact.\n- Add focused regression tests for alternating duplicate reads and non-cycle sequences.\n\n## Live evidence\n\nTiverton rounds 3-20 repeatedly replayed the same two canonical calls; cllama emitted 9 duplicate interventions for each tool, then only managed_tool_budget_finalization. No state mutation occurred after the trade was denied.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions