Swarm runner: standalone run_swarm() lacks stack env scaffolding; YIELDOMEGA_SWARM_REFERRALS=0 verification deferred #102

Closed
opened 2026-04-30 09:24:43 +00:00 by PlasticDigits · 10 comments
PlasticDigits commented 2026-04-30 09:24:43 +00:00 (Migrated from gitlab.com)

Summary

Verification of the local bot swarm path with referrals disabled (YIELDOMEGA_SWARM_REFERRALS=0) was not completed in-session and is tracked here as deferred work.

When attempting to invoke swarm_runner.run_swarm() directly (outside scripts/start-local-anvil-stack.sh), contributors hit swarm runner configuration failures attributable to missing environment scaffolding that the stack wrapper normally establishes implicitly. Until that scaffolding is repeatable for standalone runs and/or surfaced on the canonical wrapper path, the “no swarm referrals” behavior remains undertested in practice.


Background

Intended behavior (YIELDOMEGA_SWARM_REFERRALS)

The TimeCurve bot swarm optionally bootstraps a shared referral code for deterministic local QA aligned with referrer flows and indexer ingestion (GitLab #94).

Implementation:

  • swarm_referrals_enabled() in bots/timecurve/src/timecurve_bot/referral_bootstrap.py returns false when YIELDOMEGA_SWARM_REFERRALS is set to 0 (otherwise defaults to enabled).
  • When enabled, swarm_runner.py funds the registrar HD index (27), runs ensure_swarm_referral_registered(...), and sets YIELDOMEGA_REFERRAL_CODE in worker subprocess env so buys use buy(..., codeHash, ...).
  • When disabled (YIELDOMEGA_SWARM_REFERRALS=0), the swarm should skip registrar funding for referrals, skip registration bootstrap, and omit YIELDOMEGA_REFERRAL_CODE from workers so buys exercise the non-referral path.

This is documented at a high level in bots/timecurve/README.md and cross-linked from docs/testing/invariants-and-business-logic.md.

Canonical wrapper path

When START_BOT_SWARM=1, start-local-anvil-stack.sh (tail of script):

  1. Runs scripts/sync-bot-env-from-frontend.sh, which materializes bots/timecurve/.env.local from frontend/.env.local (RPC, chain id, TimeCurve / treasury / NFT addresses, acceptedAsset via cast, etc.).
  2. Selects the venv Python when present, runs dependency preflight.
  3. From repo root (cd "${ROOT}"), exports YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, sets PYTHONPATH, and executes:
    from timecurve_bot.swarm_runner import run_swarm; run_swarm()
    

run_swarm() calls load_config(env_file=None, send=True, allow_anvil_funding=False), which loads .env and, when the process cwd is the repo root, bots/timecurve/.env.local (bots/timecurve/src/timecurve_bot/config.py — load_dotenv_files).

Thus the wrapper does two critical things beside setting ALLOW_ANVIL_FUNDING:

  1. Ensures bot-facing contract/RPC variables exist by syncing frontend → bot .env.local.
  2. Runs with cwd at repo root so relative dotenv discovery matches repo conventions.

Problem statement (what went wrong)

A contributor attempted to manually reproduce swarm behavior under YIELDOMEGA_SWARM_REFERRALS=0 by calling run_swarm() outside start-local-anvil-stack.sh.

That standalone invocation did not inherit the same effective environment as the wrapper:

  • sync-bot-env-from-frontend.sh may not have been run (no fresh bots/timecurve/.env.local), producing load_config / ValueError failures such as unset YIELDOMEGA_RPC_URL / RPC_URL or unset YIELDOMEGA_TIMECURVE_ADDRESS.
  • YIELDOMEGA_ALLOW_ANVIL_FUNDING=1 may be unset, causing SystemExit(2) with the swarm’s documented guardrail.
  • Working directory may not be the repository root; load_dotenv resolution for bots/timecurve/.env.local is relative to cwd, not the package layout.
  • Even with a correct shell, forgetting PYTHONPATH to bots/timecurve/src breaks imports when not using python -m from an installed/env layout.

Net effect: the failure mode observed was a runner configuration / env orchestration gap, not necessarily a defect in swarm_referrals_enabled() logic itself. Because of that gap, YIELDOMEGA_SWARM_REFERRALS=0 was not empirically exercised during the intended session (DEFERRED).


Impact

Area Impact
QA confidence “No swarm referrals” path is weaker than “default referrals on” until someone runs swarm with =0 end-to-end.
Operator friction Only the documented wrapper composes prerequisites; ad-hoc Python entrypoints surprise contributors.
Regression risk Future changes to swarm_runner, referral_bootstrap, or worker buy wiring could regress the opt-out path without CI catching it.

Deliver one or more of the following (in order of leverage vs. scope):

A. Wrapper-visible opt-out (minimal, explicit)

Extend START_BOT_SWARM=1 UX on start-local-anvil-stack.sh to forward (or document and default-copy) YIELDOMEGA_SWARM_REFERRALS.

  • Example: If an operator exports YIELDOMEGA_SWARM_REFERRALS=0 before starting the stack, the same subprocess that calls run_swarm() inherits it—no Python code change strictly required, but today the script neither documents nor echoes this knob in the “Bot swarm” banner.
  • Enhancement: Print a one-line summary when starting the swarm: e.g. YIELDOMEGA_SWARM_REFERRALS=0 (referral bootstrap disabled) vs default.

This matches the contributor note: “follow up by setting the env on the wrapper script itself in a separate boot”—interpreted as making the wrapper path the place where this flag is first-class for local runs.

B. Document the standalone contract (docs / README)

Add a short “Run swarm without start-local-anvil-stack.sh” checklist to bots/timecurve/README.md (and optionally docs/testing/e2e-anvil.md):

  1. Deploy / have frontend/.env.local (or equivalent addresses).
  2. bash scripts/sync-bot-env-from-frontend.sh
  3. From repo root: export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1
  4. Optional: export YIELDOMEGA_SWARM_REFERRALS=0
  5. PYTHONPATH=bots/timecurve/src python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"
    or timecurve-bot --allow-anvil-funding swarm with the same env.

C. Friendlier failure messages (optional code)

In run_swarm(), when load_config fails on missing RPC/TimeCurve, catch ValueError once and append a hint pointing to sync-bot-env-from-frontend.sh and repo-root cwd (keep messages short; avoid noisy stack traces for expected misconfig).

D. Automated smoke (stretch)

A small scripted or pytest smoke that mocks/stubs RPC is likely overkill; prefer a documented one-liner plus optional CI job only if we can spin Anvil cheaply. Not required for closing this issue if manual acceptance below is satisfied.


Acceptance criteria

  1. Documented path
    There is repo-checked documentation (README and/or testing doc) that lists all prerequisites to run run_swarm() without start-local-anvil-stack.sh, including sync-bot-env-from-frontend.sh, YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, repo-root cwd, and YIELDOMEGA_SWARM_REFERRALS=0 when testing the opt-out.

  2. Wrapper discoverability
    When START_BOT_SWARM=1, the stack script mentions YIELDOMEGA_SWARM_REFERRALS in user-facing output (help text, comment block, or banner) so operators know they can set 0 without reading Python.

  3. Verified behavior (manual)
    On a fresh local Anvil stack (or equivalent):

    • With YIELDOMEGA_SWARM_REFERRALS=0, swarm starts successfully via the documented path (wrapper or standalone checklist).
    • Logs / behavior show no successful registerCode bootstrap for the swarm shared code (or N/A when registry zero), and worker env does not set YIELDOMEGA_REFERRAL_CODE (or workers buy without referral code—however the bot surfaces that).
    • With default (referrals on), prior behavior remains unchanged (regression check).
  4. Cross-links
    Update docs/testing/invariants-and-business-logic.md Local stack bot swarm row or referrals subsection to reference this issue for the YIELDOMEGA_SWARM_REFERRALS=0 verification note (one sentence).



Labels / area

area:bots · type:tech-debt or type:documentation · priority::low-to-medium (suggest; adjust per project convention)

## Summary Verification of the **local bot swarm path with referrals disabled** (`YIELDOMEGA_SWARM_REFERRALS=0`) was **not completed in-session** and is tracked here as deferred work. When attempting to invoke `swarm_runner.run_swarm()` **directly** (outside [`scripts/start-local-anvil-stack.sh`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/scripts/start-local-anvil-stack.sh)), contributors hit **swarm runner configuration failures** attributable to missing **environment scaffolding** that the stack wrapper normally establishes implicitly. Until that scaffolding is repeatable for standalone runs **and/or** surfaced on the canonical wrapper path, the “no swarm referrals” behavior remains **undertested in practice**. --- ## Background ### Intended behavior (`YIELDOMEGA_SWARM_REFERRALS`) The TimeCurve bot swarm optionally bootstraps a **shared referral code** for deterministic local QA aligned with referrer flows and indexer ingestion ([GitLab #94](https://gitlab.com/PlasticDigits/yieldomega/-/issues/94)). Implementation: - **`swarm_referrals_enabled()`** in [`bots/timecurve/src/timecurve_bot/referral_bootstrap.py`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/src/timecurve_bot/referral_bootstrap.py) returns **false** when `YIELDOMEGA_SWARM_REFERRALS` is set to **`0`** (otherwise defaults to enabled). - When enabled, [`swarm_runner.py`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/src/timecurve_bot/swarm_runner.py) funds the registrar HD index (**27**), runs `ensure_swarm_referral_registered(...)`, and sets **`YIELDOMEGA_REFERRAL_CODE`** in worker subprocess env so buys use **`buy(..., codeHash, ...)`**. - When **disabled** (`YIELDOMEGA_SWARM_REFERRALS=0`), the swarm should **skip** registrar funding for referrals, skip registration bootstrap, and **omit** `YIELDOMEGA_REFERRAL_CODE` from workers so buys exercise the **non-referral** path. This is documented at a high level in [`bots/timecurve/README.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/README.md) and cross-linked from [`docs/testing/invariants-and-business-logic.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/docs/testing/invariants-and-business-logic.md). ### Canonical wrapper path When `START_BOT_SWARM=1`, [`start-local-anvil-stack.sh`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/scripts/start-local-anvil-stack.sh) (tail of script): 1. Runs **`scripts/sync-bot-env-from-frontend.sh`**, which materializes **`bots/timecurve/.env.local`** from **`frontend/.env.local`** (RPC, chain id, TimeCurve / treasury / NFT addresses, `acceptedAsset` via `cast`, etc.). 2. Selects the venv Python when present, runs dependency preflight. 3. From **repo root** (`cd "${ROOT}"`), exports **`YIELDOMEGA_ALLOW_ANVIL_FUNDING=1`**, sets **`PYTHONPATH`**, and executes: ```python from timecurve_bot.swarm_runner import run_swarm; run_swarm() ``` `run_swarm()` calls **`load_config(env_file=None, send=True, allow_anvil_funding=False)`**, which loads **`.env`** and, when the process **cwd** is the repo root, **`bots/timecurve/.env.local`** ([`bots/timecurve/src/timecurve_bot/config.py`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/src/timecurve_bot/config.py) — `load_dotenv_files`). Thus the wrapper does **two** critical things beside setting `ALLOW_ANVIL_FUNDING`: 1. **Ensures** bot-facing contract/RPC variables exist by syncing frontend → bot `.env.local`. 2. **Runs with cwd at repo root** so relative dotenv discovery matches repo conventions. --- ## Problem statement (what went wrong) A contributor attempted to **manually reproduce** swarm behavior under **`YIELDOMEGA_SWARM_REFERRALS=0`** by calling **`run_swarm()`** outside **`start-local-anvil-stack.sh`**. That **standalone** invocation **did not inherit** the same effective environment as the wrapper: - **`sync-bot-env-from-frontend.sh`** may not have been run (no fresh **`bots/timecurve/.env.local`**), producing **`load_config`** / **`ValueError`** failures such as unset **`YIELDOMEGA_RPC_URL` / `RPC_URL`** or unset **`YIELDOMEGA_TIMECURVE_ADDRESS`**. - **`YIELDOMEGA_ALLOW_ANVIL_FUNDING=1`** may be unset, causing **`SystemExit(2)`** with the swarm’s documented guardrail. - **Working directory** may not be the repository root; `load_dotenv` resolution for **`bots/timecurve/.env.local`** is relative to **cwd**, not the package layout. - Even with a correct shell, forgetting **`PYTHONPATH`** to **`bots/timecurve/src`** breaks imports when not using **`python -m`** from an installed/env layout. **Net effect:** the failure mode observed was a **runner configuration / env orchestration gap**, not necessarily a defect in **`swarm_referrals_enabled()`** logic itself. Because of that gap, **`YIELDOMEGA_SWARM_REFERRALS=0` was not empirically exercised** during the intended session (**DEFERRED**). --- ## Impact | Area | Impact | |------|--------| | **QA confidence** | “No swarm referrals” path is weaker than “default referrals on” until someone runs swarm with `=0` end-to-end. | | **Operator friction** | Only the **documented wrapper** composes prerequisites; **ad-hoc** Python entrypoints surprise contributors. | | **Regression risk** | Future changes to `swarm_runner`, `referral_bootstrap`, or worker `buy` wiring could regress the opt-out path without CI catching it. | --- ## Recommended fixes Deliver one or more of the following (in order of leverage vs. scope): ### A. Wrapper-visible opt-out (minimal, explicit) Extend **`START_BOT_SWARM=1`** UX on **`start-local-anvil-stack.sh`** to **forward** (or document and default-copy) **`YIELDOMEGA_SWARM_REFERRALS`**. - Example: If an operator exports **`YIELDOMEGA_SWARM_REFERRALS=0`** before starting the stack, the **same subprocess** that calls `run_swarm()` inherits it—**no Python code change strictly required**, but today the script neither documents nor echoes this knob in the “Bot swarm” banner. - **Enhancement:** Print a one-line summary when starting the swarm: e.g. `YIELDOMEGA_SWARM_REFERRALS=0 (referral bootstrap disabled)` vs default. This matches the contributor note: *“follow up by setting the env on the wrapper script itself in a separate boot”*—interpreted as making the **wrapper path** the place where this flag is **first-class** for local runs. ### B. Document the standalone contract (docs / README) Add a short **“Run swarm without `start-local-anvil-stack.sh`”** checklist to [`bots/timecurve/README.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/README.md) (and optionally [`docs/testing/e2e-anvil.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/docs/testing/e2e-anvil.md)): 1. Deploy / have **`frontend/.env.local`** (or equivalent addresses). 2. **`bash scripts/sync-bot-env-from-frontend.sh`** 3. From **repo root**: `export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1` 4. Optional: `export YIELDOMEGA_SWARM_REFERRALS=0` 5. `PYTHONPATH=bots/timecurve/src python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"` or **`timecurve-bot --allow-anvil-funding swarm`** with the same env. ### C. Friendlier failure messages (optional code) In **`run_swarm()`**, when **`load_config`** fails on missing RPC/TimeCurve, catch **`ValueError`** once and append a **hint** pointing to **`sync-bot-env-from-frontend.sh`** and **repo-root cwd** (keep messages short; avoid noisy stack traces for expected misconfig). ### D. Automated smoke (stretch) A small **scripted** or **pytest** smoke that mocks/stubs RPC is likely overkill; prefer a **documented one-liner** plus optional **CI job** only if we can spin Anvil cheaply. **Not required** for closing this issue if manual acceptance below is satisfied. --- ## Acceptance criteria 1. **Documented path** There is **repo-checked documentation** (README and/or testing doc) that lists **all** prerequisites to run `run_swarm()` **without** `start-local-anvil-stack.sh`, including **`sync-bot-env-from-frontend.sh`**, **`YIELDOMEGA_ALLOW_ANVIL_FUNDING=1`**, **repo-root cwd**, and **`YIELDOMEGA_SWARM_REFERRALS=0`** when testing the opt-out. 2. **Wrapper discoverability** When **`START_BOT_SWARM=1`**, the stack script **mentions** `YIELDOMEGA_SWARM_REFERRALS` in user-facing output (help text, comment block, or banner) so operators know they can set **`0`** without reading Python. 3. **Verified behavior (manual)** On a **fresh** local Anvil stack (or equivalent): - With **`YIELDOMEGA_SWARM_REFERRALS=0`**, swarm starts successfully **via the documented path** (wrapper **or** standalone checklist). - Logs / behavior show **no** successful `registerCode` bootstrap for the swarm shared code (or N/A when registry zero), and worker env **does not** set **`YIELDOMEGA_REFERRAL_CODE`** (or workers buy without referral code—however the bot surfaces that). - With default (referrals on), prior behavior remains unchanged (regression check). 4. **Cross-links** Update [`docs/testing/invariants-and-business-logic.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/docs/testing/invariants-and-business-logic.md) **Local stack bot swarm** row or referrals subsection to reference this issue for the **`YIELDOMEGA_SWARM_REFERRALS=0`** verification note (one sentence). --- ## Related references - Referrals / indexer: [GitLab #94](https://gitlab.com/PlasticDigits/yieldomega/-/issues/94) - Bot deps / PEP 668: [GitLab #50](https://gitlab.com/PlasticDigits/yieldomega/-/issues/50) - Swarm + Anvil time: [GitLab #99](https://gitlab.com/PlasticDigits/yieldomega/-/issues/99) --- ## Labels / area `area:bots` · `type:tech-debt` or `type:documentation` · `priority::low-to-medium` (suggest; adjust per project convention)
PlasticDigits commented 2026-04-30 09:24:44 +00:00 (Migrated from gitlab.com)

marked this issue as related to #94

marked this issue as related to #94
PlasticDigits commented 2026-04-30 09:35:38 +00:00 (Migrated from gitlab.com)

mentioned in commit 6b036a14ad

mentioned in commit 6b036a14ad5047c24001fa7ac9199c8ac7435f22
PlasticDigits commented 2026-04-30 09:36:03 +00:00 (Migrated from gitlab.com)

Implemented A + B + C from this issue and pushed to main (6b036a1).

What changed

/cc @brouie — please verify on your side (issue stays open per contributor request).

Verification checklist

  • From repo root: export YIELDOMEGA_SWARM_REFERRALS=0 then SKIP_ANVIL_RICH_STATE=1 bash scripts/start-local-anvil-stack.sh — banner shows referrals off; swarm starts; workers buy without shared referral bootstrap (no YIELDOMEGA_REFERRAL_CODE in worker env; no registrar funding line for index 27).
  • Same without YIELDOMEGA_SWARM_REFERRALS=0 — banner shows referrals on; prior behavior unchanged.
  • Standalone path: with existing frontend/.env.local, bash scripts/sync-bot-env-from-frontend.sh, export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, repo-root cwd, PYTHONPATH=bots/timecurve/src python3 - c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()" — swarm runs (or fails only for chain reasons, not missing env).
  • Misconfiguration: unset RPC — run_swarm() prints one error line + Hint mentioning sync-bot-env-from-frontend.sh and repo-root cwd; exit code 2.
Implemented **A + B + C** from this issue and pushed to `main` ([`6b036a1`](https://gitlab.com/PlasticDigits/yieldomega/-/commit/6b036a1)). **What changed** - **A (wrapper):** [`scripts/start-local-anvil-stack.sh`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/scripts/start-local-anvil-stack.sh) documents `YIELDOMEGA_SWARM_REFERRALS` in the header and prints a one-line summary when `START_BOT_SWARM=1` (on vs off / opt-out). - **B (docs):** Standalone `run_swarm()` checklist in [`bots/timecurve/README.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/README.md); env table row + § *Standalone bot swarm* in [`docs/testing/e2e-anvil.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/docs/testing/e2e-anvil.md); invariants row + cross-links in [`docs/testing/invariants-and-business-logic.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/docs/testing/invariants-and-business-logic.md), [`skills/README.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/skills/README.md), [`bots/timecurve/SKILL.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/SKILL.md), [`.cursor/skills/yieldomega-guardrails/SKILL.md`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/.cursor/skills/yieldomega-guardrails/SKILL.md). - **C (code):** [`swarm_runner._load_config_for_swarm()`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/src/timecurve_bot/swarm_runner.py) catches `load_config` `ValueError`, prints a short hint (`sync-bot-env-from-frontend.sh`, repo-root cwd, `YIELDOMEGA_ALLOW_ANVIL_FUNDING`), exits **2** without a traceback. Unit test: [`bots/timecurve/tests/test_swarm_runner.py`](https://gitlab.com/PlasticDigits/yieldomega/-/blob/main/bots/timecurve/tests/test_swarm_runner.py). Full bot `pytest` run: **17 passed**. /cc @brouie — please verify on your side (issue stays open per contributor request). **Verification checklist** - [ ] From repo root: `export YIELDOMEGA_SWARM_REFERRALS=0` then `SKIP_ANVIL_RICH_STATE=1 bash scripts/start-local-anvil-stack.sh` — banner shows referrals **off**; swarm starts; workers buy without shared referral bootstrap (no `YIELDOMEGA_REFERRAL_CODE` in worker env; no registrar funding line for index 27). - [ ] Same without `YIELDOMEGA_SWARM_REFERRALS=0` — banner shows referrals **on**; prior behavior unchanged. - [ ] Standalone path: with existing `frontend/.env.local`, `bash scripts/sync-bot-env-from-frontend.sh`, `export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1`, repo-root cwd, `PYTHONPATH=bots/timecurve/src python3 - c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"` — swarm runs (or fails only for chain reasons, not missing env). - [ ] Misconfiguration: unset RPC — `run_swarm()` prints **one** error line + **Hint** mentioning `sync-bot-env-from-frontend.sh` and repo-root cwd; exit code **2**.
PlasticDigits commented 2026-04-30 09:36:34 +00:00 (Migrated from gitlab.com)

Typo fix for checklist item 3: use a single line (no line break after python3):

PYTHONPATH=bots/timecurve/src python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"

**Typo fix for checklist item 3:** use a single line (no line break after `python3`): `PYTHONPATH=bots/timecurve/src python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"`
Brouie commented 2026-05-01 03:14:29 +00:00 (Migrated from gitlab.com)

Items 1 + 2 PASS on bf00d60 (parent 6b036a1). Wrapper boots verified clean from a torn-down stack.

Item 2 — default referrals ON (regression check)

Banner: Swarm referrals: ON — shared code for workers (export YIELDOMEGA_SWARM_REFERRALS=0 to opt out — GitLab #102)

Bootstrap (3 lines, /tmp/yo_stack_102_item2.log):

  • swarm: funding referral registrar index 27 for code registration
  • registerCode('swarmyo') tx=b0322ec45a90565a39dd423515e3d285c370d9c09ba88a4d40b3d7624c352f57 status=1
  • swarm referrals: registered 'swarmyo' for 0x87BdCE72c06C21cd96219BD8521bDF1F42C78b5e

Indexer ingestion (~3.5 min uptime): HD-27 rank 1, referred_buy_count=28, total_referrer_charm_wad=6127198716742986130 (~6.13 CHARM). Behavior matches #94 EOD baseline.

Item 1 — opt-out YIELDOMEGA_SWARM_REFERRALS=0

Banner: YIELDOMEGA_SWARM_REFERRALS=0 — referral bootstrap disabled (non-referral buy path)

Stack log: zero matches for registerCode|swarmyo|HD-?27|registrar|REFERRAL_CODE (no registrar funding, no registerCode tx, no swarmyo registration).

Worker env (PID 1016283 timecurve_bot.cli seed-local, /proc/<pid>/environ):

  • YIELDOMEGA_SWARM_REFERRALS=0 present (passes through)
  • YIELDOMEGA_REFERRAL_CODE ABSENT — workers buy non-referral path
  • YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, YIELDOMEGA_RPC_URL, YIELDOMEGA_CHAIN_ID all set (sync-bot-env baseline normal)

Indexer leaderboard after 30s+ swarm activity: {"items": [], ...}. No ReferralApplied on-chain.

Bot count = 18 (3× seed-local/defender/fun/shark/pvp/rando) — swarm spawning matches default-on, only referral bootstrap skipped.

Items 3 (standalone path) + 4 (misconfig hint + exit 2) — verifying next on this same Item 1 stack. Will post on completion.

**Items 1 + 2 PASS** on `bf00d60` (parent `6b036a1`). Wrapper boots verified clean from a torn-down stack. **Item 2 — default referrals ON (regression check)** Banner: `Swarm referrals: ON — shared code for workers (export YIELDOMEGA_SWARM_REFERRALS=0 to opt out — GitLab #102)` Bootstrap (3 lines, `/tmp/yo_stack_102_item2.log`): - `swarm: funding referral registrar index 27 for code registration` - `registerCode('swarmyo') tx=b0322ec45a90565a39dd423515e3d285c370d9c09ba88a4d40b3d7624c352f57 status=1` - `swarm referrals: registered 'swarmyo' for 0x87BdCE72c06C21cd96219BD8521bDF1F42C78b5e` Indexer ingestion (~3.5 min uptime): HD-27 rank 1, `referred_buy_count=28`, `total_referrer_charm_wad=6127198716742986130` (~6.13 CHARM). Behavior matches #94 EOD baseline. **Item 1 — opt-out `YIELDOMEGA_SWARM_REFERRALS=0`** Banner: `YIELDOMEGA_SWARM_REFERRALS=0 — referral bootstrap disabled (non-referral buy path)` Stack log: zero matches for `registerCode|swarmyo|HD-?27|registrar|REFERRAL_CODE` (no registrar funding, no registerCode tx, no swarmyo registration). Worker env (PID 1016283 `timecurve_bot.cli seed-local`, `/proc/<pid>/environ`): - `YIELDOMEGA_SWARM_REFERRALS=0` present (passes through) - `YIELDOMEGA_REFERRAL_CODE` ABSENT — workers buy non-referral path - `YIELDOMEGA_ALLOW_ANVIL_FUNDING=1`, `YIELDOMEGA_RPC_URL`, `YIELDOMEGA_CHAIN_ID` all set (sync-bot-env baseline normal) Indexer leaderboard after 30s+ swarm activity: `{"items": [], ...}`. No `ReferralApplied` on-chain. Bot count = 18 (3× seed-local/defender/fun/shark/pvp/rando) — swarm spawning matches default-on, only referral bootstrap skipped. Items 3 (standalone path) + 4 (misconfig hint + exit 2) — verifying next on this same Item 1 stack. Will post on completion.
Brouie commented 2026-05-01 03:21:16 +00:00 (Migrated from gitlab.com)

Item 4 — misconfiguration (unset RPC)

Repro:
cd /tmp
env -i HOME=$HOME PATH=$PATH YIELDOMEGA_ALLOW_ANVIL_FUNDING=1
PYTHONPATH=/srv/qa/repos/yieldomega/bots/timecurve/src
python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()"

Output (exact):
swarm: config error: Set YIELDOMEGA_RPC_URL or RPC_URL to an HTTP JSON-RPC endpoint.
Hint: from repository root run bash scripts/sync-bot-env-from-frontend.sh (needs frontend/.env.local or equivalent), export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, and use repo-root cwd so bots/timecurve/.env.local is loaded by load_config.
EXIT_CODE: 2

Spec checks:

  • one error line: PASS
  • one Hint line: PASS
  • mentions sync-bot-env-from-frontend.sh: PASS
  • mentions repo-root cwd: PASS
  • exit code 2: PASS
  • no stack trace: PASS

Notes:

  • Test setup uses /tmp as cwd (NOT repo root) so dotenv discovery in load_config skips bots/timecurve/.env.local — exercises the actual misconfig path Hint targets.
  • YIELDOMEGA_ALLOW_ANVIL_FUNDING=1 is required to pass the swarm runner's pre-load guardrail; without it the runner exits early on the funding hint instead of reaching load_config (correct guardrail layering).

PASS.

## Item 4 — misconfiguration (unset RPC) Repro: cd /tmp env -i HOME=$HOME PATH=$PATH YIELDOMEGA_ALLOW_ANVIL_FUNDING=1 \ PYTHONPATH=/srv/qa/repos/yieldomega/bots/timecurve/src \ python3 -c "from timecurve_bot.swarm_runner import run_swarm; run_swarm()" Output (exact): swarm: config error: Set YIELDOMEGA_RPC_URL or RPC_URL to an HTTP JSON-RPC endpoint. Hint: from repository root run `bash scripts/sync-bot-env-from-frontend.sh` (needs `frontend/.env.local` or equivalent), export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1, and use repo-root cwd so `bots/timecurve/.env.local` is loaded by `load_config`. EXIT_CODE: 2 Spec checks: - one error line: PASS - one Hint line: PASS - mentions sync-bot-env-from-frontend.sh: PASS - mentions repo-root cwd: PASS - exit code 2: PASS - no stack trace: PASS Notes: - Test setup uses /tmp as cwd (NOT repo root) so dotenv discovery in load_config skips bots/timecurve/.env.local — exercises the actual misconfig path Hint targets. - YIELDOMEGA_ALLOW_ANVIL_FUNDING=1 is required to pass the swarm runner's pre-load guardrail; without it the runner exits early on the funding hint instead of reaching load_config (correct guardrail layering). PASS.
Brouie commented 2026-05-01 03:29:15 +00:00 (Migrated from gitlab.com)

Item 3 — standalone path (happy path)

Repro (verbatim from dev's checklist):
cd /srv/qa/repos/yieldomega
bash scripts/sync-bot-env-from-frontend.sh # Wrote bots/timecurve/.env.local
export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1
PYTHONPATH=bots/timecurve/src nohup python3 -c
"from timecurve_bot.swarm_runner import run_swarm; run_swarm()"
> /tmp/yo_item3_standalone.log 2>&1 &

Result: parent exited cleanly, 18 worker bots spawned and running.

Bootstrap output (key lines from /tmp/yo_item3_standalone.log):
swarm: funding referral registrar index 27 for code registration
swarm: one-shot Anvil dev funding (anvil_setBalance + mock mint)
[28x mint(CL8Y mock) tx=... status=1 lines]
swarm: anvil_setBalance 10000 ETH for 28 swarm addresses (gas).
swarm: minted 1000000000000000000000000000000000 wei mock reserve to 28 addresses.
approve tx=145c7bf97... status=1
registerCode('swarmyo') tx=6eec65660522a6922a987f5be9207d5692f9e857e2337257b903683015299e31 status=1
swarm referrals: registered 'swarmyo' for 0x87BdCE72c06C21cd96219BD8521bDF1F42C78b5e
[18x swarm: started -N pid=... log=/tmp/yieldomega_swarm_-N.log lines]
swarm: 18 processes; PIDs in /tmp/yieldomega_bot_swarm.pids

Pidfile (/tmp/yieldomega_bot_swarm.pids): 18 PIDs, all match ps output for active workers.

ps confirms 18 timecurve_bot.cli workers running (3x each: seed-local, defender, fun, shark, pvp, rando).

Spec checks:

  • Standalone runs without wrapper: PASS
  • No missing-env failures: PASS
  • Chain-level activity only (mints, approves, registerCode): PASS

PASS.

## Item 3 — standalone path (happy path) Repro (verbatim from dev's checklist): cd /srv/qa/repos/yieldomega bash scripts/sync-bot-env-from-frontend.sh # Wrote bots/timecurve/.env.local export YIELDOMEGA_ALLOW_ANVIL_FUNDING=1 PYTHONPATH=bots/timecurve/src nohup python3 -c \ "from timecurve_bot.swarm_runner import run_swarm; run_swarm()" \ > /tmp/yo_item3_standalone.log 2>&1 & Result: parent exited cleanly, 18 worker bots spawned and running. Bootstrap output (key lines from /tmp/yo_item3_standalone.log): swarm: funding referral registrar index 27 for code registration swarm: one-shot Anvil dev funding (anvil_setBalance + mock mint) [28x mint(CL8Y mock) tx=... status=1 lines] swarm: anvil_setBalance 10000 ETH for 28 swarm addresses (gas). swarm: minted 1000000000000000000000000000000000 wei mock reserve to 28 addresses. approve tx=145c7bf97... status=1 registerCode('swarmyo') tx=6eec65660522a6922a987f5be9207d5692f9e857e2337257b903683015299e31 status=1 swarm referrals: registered 'swarmyo' for 0x87BdCE72c06C21cd96219BD8521bDF1F42C78b5e [18x swarm: started <name>-N pid=... log=/tmp/yieldomega_swarm_<name>-N.log lines] swarm: 18 processes; PIDs in /tmp/yieldomega_bot_swarm.pids Pidfile (/tmp/yieldomega_bot_swarm.pids): 18 PIDs, all match `ps` output for active workers. ps confirms 18 timecurve_bot.cli workers running (3x each: seed-local, defender, fun, shark, pvp, rando). Spec checks: - Standalone runs without wrapper: PASS - No missing-env failures: PASS - Chain-level activity only (mints, approves, registerCode): PASS PASS.
Brouie commented 2026-05-01 03:29:45 +00:00 (Migrated from gitlab.com)

All 4 acceptance items PASS on bf00d60 (parent fix 6b036a1).

Summary:

  • Item 1 wrapper opt-out (YIELDOMEGA_SWARM_REFERRALS=0): banner OFF, no registrar funding, no registerCode tx, worker env has no YIELDOMEGA_REFERRAL_CODE, indexer leaderboard empty after 30s+ — note 3305970395
  • Item 2 wrapper default (referrals ON): banner ON, full bootstrap (registerCode('swarmyo') tx=b0322ec..., registered for 0x87BdCE72...), HD-27 indexer ingestion confirmed (28 buys / 6.13 CHARM in 3.5min) — note 3305970395
  • Item 3 standalone path (PYTHONPATH=... python3 -c "...run_swarm()" from repo root): full bootstrap clean (28x mints, anvil_setBalance 10000 ETH for 28 addrs, 1e33 wei mock reserve, registerCode tx=6eec656..., 18 workers spawned with PIDs logged), no missing-env failures — note 3305992211
  • Item 4 misconfig (cd /tmp + unset RPC + funding flag set): one error line + one Hint line mentioning sync-bot-env-from-frontend.sh + repo-root cwd + bots/timecurve/.env.local, exit code 2, no traceback — note 3305984353

AC #1 (documented path), #2 (wrapper discoverability via banner + header comment line 19-20), #3 (verified behavior, all three sub-bullets PASS), #4 (cross-links in invariants doc) — all satisfied.

Closing.

**All 4 acceptance items PASS on `bf00d60` (parent fix `6b036a1`).** Summary: - **Item 1** wrapper opt-out (`YIELDOMEGA_SWARM_REFERRALS=0`): banner OFF, no registrar funding, no `registerCode` tx, worker env has no `YIELDOMEGA_REFERRAL_CODE`, indexer leaderboard empty after 30s+ — note 3305970395 - **Item 2** wrapper default (referrals ON): banner ON, full bootstrap (`registerCode('swarmyo') tx=b0322ec...`, registered for `0x87BdCE72...`), HD-27 indexer ingestion confirmed (28 buys / 6.13 CHARM in 3.5min) — note 3305970395 - **Item 3** standalone path (`PYTHONPATH=... python3 -c "...run_swarm()"` from repo root): full bootstrap clean (28x mints, anvil_setBalance 10000 ETH for 28 addrs, 1e33 wei mock reserve, `registerCode tx=6eec656...`, 18 workers spawned with PIDs logged), no missing-env failures — note 3305992211 - **Item 4** misconfig (cd /tmp + unset RPC + funding flag set): one error line + one Hint line mentioning `sync-bot-env-from-frontend.sh` + repo-root cwd + `bots/timecurve/.env.local`, exit code 2, no traceback — note 3305984353 AC #1 (documented path), #2 (wrapper discoverability via banner + header comment line 19-20), #3 (verified behavior, all three sub-bullets PASS), #4 (cross-links in invariants doc) — all satisfied. Closing.
Brouie (Migrated from gitlab.com) closed this issue 2026-05-01 03:29:46 +00:00
PlasticDigits commented 2026-05-01 06:11:32 +00:00 (Migrated from gitlab.com)

mentioned in issue #104

mentioned in issue #104
PlasticDigits commented 2026-05-05 13:57:31 +00:00 (Migrated from gitlab.com)

mentioned in issue #162

mentioned in issue #162
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/yieldomega#102
No description provided.