Skip to content

fix(models): wire RealitioWithdrawBonds SharedState into composed MRO (crash-loop fix) - #231

Merged
jmoreira-valory merged 1 commit into
mainfrom
fix/withdraw-bonds-sharedstate-mro
Jun 30, 2026
Merged

fix(models): wire RealitioWithdrawBonds SharedState into composed MRO (crash-loop fix)#231
jmoreira-valory merged 1 commit into
mainfrom
fix/withdraw-bonds-sharedstate-mro

Conversation

@jmoreira-valory

Copy link
Copy Markdown
Contributor

Same crash-loop fix as market-resolver#35, applied to market-creator

After the resume-after-timeout claim cache (omen_realitio_withdraw_bonds_abci v0.1.2, cascaded via #230) merged, market-creator main was left in the same crash-prone state the resolver hit in production: the composed market_maker_abci.SharedState does not include the withdraw-bonds sub-skill in its MRO, so realitio_claim_build_cache is never initialised on the runtime self.context.state.

RealitioWithdrawBondsBehaviour._build_claim_txs reads it directly:

```
AttributeError: 'SharedState' object has no attribute 'realitio_claim_build_cache'
-> AEAActException -> skill_exception_policy: stop_and_exit -> Propel restart loop
```

The market-creator deployment was not yet bumped to the cache CID (the agent-deployments env bump was held), so this is a pre-deploy fix — no production impact, unlike the resolver.

Fix — standard repo pattern

The composed SharedState already multiply-inherits MechInteractSharedState and CtRedeemTokensSharedState so their __init__ cross-round vars (ignored_ct_positions, mech state) land on the runtime state. This adds RealitioWithdrawBondsSharedState alongside them:

```python
class SharedState(
MechInteractSharedState,
BaseSharedState,
CtRedeemTokensSharedState,
RealitioWithdrawBondsSharedState, # <- added
):
```

The class docstring is updated to spell out the invariant (omitting a sub-skill whose behaviour reads self.context.state.<attr> crash-loops).

Verification

```
instantiate composed SharedState -> realitio_claim_build_cache == {} (next to ignored_ct_positions)
```

Test plan

  • TestSharedState (4) incl. new regression (attr initialised + sub-skill in MRO)
  • market_maker_abci suite 58 passed
  • lint green (isort/black/flake8/mypy/pylint/darglint)
  • structural green (check-abciapp-specs/handlers/packages)
  • autonomy packages lock cascade; third_party preserved

Rollout

Merge → service CID bafybeibb5msj3gggv2clat37k4vfpalsjr6bveym3ve6ty64ean3tpgpzy. The held agent-deployments creator env bumps (QS + Pearl) must target this fixed CID, not #230's.

Mirrors market-resolver#35. After the resume-after-timeout claim cache
(omen_realitio_withdraw_bonds_abci v0.1.2, cascaded via #230) merged,
market-creator main was left in a crash-prone state: the composed
``market_maker_abci.SharedState`` did not include the withdraw-bonds
sub-skill in its MRO, so ``realitio_claim_build_cache`` was never
initialised on the runtime ``self.context.state``.
``RealitioWithdrawBondsBehaviour._build_claim_txs`` reads it directly,
which would raise:

    AttributeError: 'SharedState' object has no attribute
                    'realitio_claim_build_cache'
    -> AEAActException -> skill_exception_policy: stop_and_exit
    -> Propel restart loop (as observed on market_resolver_ci)

The composed SharedState already multiply-inherits MechInteract and
CtRedeem SharedStates so their ``__init__`` cross-round vars land on the
runtime state; this adds ``RealitioWithdrawBondsSharedState`` alongside
them. Verified: the composed SharedState now yields
``realitio_claim_build_cache == {}`` next to ``ignored_ct_positions``.
Regression test added (attr initialised + sub-skill in MRO).

58 market_maker_abci tests pass; lint + structural green.
Comment thread packages/valory/skills/market_maker_abci/tests/test_models.py

@OjusWiZard OjusWiZard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve — minimal, well-targeted crash-loop fix.

  • MRO is sound: RealitioWithdrawBondsSharedState is appended last, so it can't override any previously-resolved method; its only effect is contributing __init__ to the cooperative super() chain (same mechanism as ignored_ct_positions).
  • Regression test asserts both MRO membership and realitio_claim_build_cache == {} after real instantiation — the right pair of assertions for this bug class.
  • Import follows the file's existing force_single_line isort convention.
  • Hash cascade is internally consistent (skill CID matches aea-config; agent CID matches service.yaml; service CID matches the rollout CID in the PR body).
  • Docstring now documents the invariant.

LGTM.

@jmoreira-valory
jmoreira-valory merged commit 2fc6a5b into main Jun 30, 2026
22 checks passed
@jmoreira-valory
jmoreira-valory deleted the fix/withdraw-bonds-sharedstate-mro branch June 30, 2026 10:28
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.

4 participants