Skip to content

DyLAN and MacNet retry loops are still unbounded #13

Description

@12yuens2

DyLAN and MacNet retry loops are still unbounded

bug tech-debt · found during Phase 2, deliberately deferred

Phase 2 replaced the hand-written agent retry loops with MetaMAS._call_agent_with_retries (afbf5f3), but only in autogen.py and autogen_mas.py. DyLAN and MacNet still hold their own copies. Deferred by direction — only AutoGen is in use for the MAS.

tasks/mas_workflow/dylan/dylan.py:219 and tasks/mas_workflow/macnet/graph_mas.py:~146:

tries = 0
while tries < 3:
    try:
        action = curr_neuron.execute(user_prompt, use_critic=self._use_critic)
        if action == '':
            continue          # <- jumps past the increment below
        action = env.process_action(action)
        break
    except Exception as e:
        print(f'Error during execution of node {curr_neuron.id}: {e}')
    tries += 1

The counter sits at the bottom of the body and is reached only on the exception path. An empty response hits the continue and skips it, so the loop never terminates for an agent that keeps returning "".

GPTChat now raises instead of returning "" (aaa8ebe), so the most likely trigger is gone — an API error is now an exception, which does reach the increment. The loop is still unbounded for a model that genuinely answers with an empty string, and action can still reach AgentMessage(message=action) unbound if every attempt raises before it is assigned.

The fix, when these come back into use. Replace both loops with self._call_agent_with_retries(...). The helper takes the attempt as a callable, so curr_neuron.execute and curr_node.execute slot straight in. Wrap it in the same except AgentCallFailed: break the AutoGen workflows use (8bcb42c), and charge the full budget as they do (91e3a99). Fold in the max_trials naming fix (see the separate issue) at the same time.

Phase 4 raised the value of doing it. MetaMAS._reviewed_attempt (07d6bb2) puts the validator's contract on the base class, so --use_validator would work for DyLAN and MacNet too — but only once their loops go through _call_agent_with_retries, which is what this issue is. Until then the flag is accepted for any --mas_type and only autogen acts on it.

What Phase 2 did give them, so they are not stranded: both return EpisodeResult (7e8a06a — before this, --mas_type dylan and --mas_type macnet raised ValueError: not enough values to unpack on the first completed task); inherit add_observer/notify_observers from MetaMAS; share the summarize keyword contract (2cc0d3c — MacNet's upstream_agent_ids=None broke all six intrinsic memory modules); share the trials convention (2ead4a3); and are covered by the contract and smoke matrices. DyLAN also stopped ignoring the configured embedding model (7fcbf1d).


Migrated from docs/BACKLOG.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtech-debtRefactor / debt cleanup, not a behaviour bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions