loopx icon indicating copy to clipboard operation
loopx copied to clipboard

[Task]: extend auto-research worker-loop lifecycle with explicit control transitions

Open rootkiller6788 opened this issue 4 months ago • 3 comments

Task ID or area

GH-C43:extend auto-research worker-loop lifecycle with explicit control transitions

Intent

I want to claim an existing task

Summary

Reference

Pre-defined task on CONTRIBUTOR_TASKS.md:

GH-C43 — Extend the shipped Auto Research long-running showcase with a contributor-safe stop/takeover and state-aware wakeup walkthrough. Reuse the current command path and synthetic/redacted evidence; do not add a second launcher or alter the README first screen.

Problem

The auto-research worker-loop (run_auto_research_worker_loop) currently exits only via max_rounds, no_runnable_frontier, or no_executed_turns. Three gaps prevent operator-in-the-loop control:

  1. No external stop signal. An operator must either wait for natural exhaustion or kill the process. No in-band mechanism to pause while preserving state.

  2. Blind post-launch visible wake. wake_visible_after_launch broadcasts to every started lane unconditionally — including lanes at quiet_completion or with frontier.selected == null.

  3. No documented takeover path. --attach exists but no testable walkthrough proves the stop → manual lane advance → resume cycle.

Proposed design

Three additions, all reusing the shipped load_auto_research_worker_frontier() and quota.should_run contracts. Zero new launch paths, zero new APIs.

1. External stop signal (worker_loop.py)

Check workspace/.loopx-auto-research-stop before each round. When present → exit with stop_reason = operator_stop_requested.

  • Plain file — no inotify, no extra process, no quota spend.
  • Does NOT gate individual worker-turn calls (takeover preserved).
  • Checked every round, not just at entry.

2. State-aware visible wake (demo_e2e.py)

Before broadcasting the wake, call load_auto_research_worker_frontier() for each started lane. Skip lanes where:

Condition Skip reason
completion.quiet_completion_allowed Goal already met
frontier.selected == None No runnable todo
quota.should_run == False Scheduler blocked

Filtered lanes recorded under state_aware_filter for auditability.

3. Quota-aware pause (worker_runtime.py)

When quota.ok && !quota.should_run → return mode = paused_by_quota (before execution, after todo selection). Worker-loop distinguishes quota_paused from no_executed_turns.

4. Takeover walkthrough smoke (new)

Synthetic-data smoke proving the complete cycle: seed → loop → stop → operator takeover (single-lane worker-turn + hand-crafted successor via add_goal_todo/complete_goal_todo) → resume.

No live model, no credentials, no private paths.

Current status

Implementation is ready on a local branch — available for review, not yet pushed. Changes (4 files, ~650 lines):

File Change
capabilities/auto_research/demo_e2e.py +111/−10
capabilities/auto_research/worker_loop.py +9/−2
capabilities/auto_research/worker_runtime.py +21
examples/…walkthrough-smoke.py +521 (new)

All existing auto-research smokes pass, loopx check clean.

Questions for maintainer

  1. Is the stop-marker file approach acceptable, or should the stop signal route through the LoopX state layer (quota/goal frontier)?

Proposed scope

  • Add an external stop signal to the worker-loop: check a marker file (workspace/.loopx-auto-research-stop) before each round; exit with stop_reason = operator_stop_requested when present.
  • Add a paused_by_quota return mode to run_auto_research_worker_turn() when quota.should_run is explicitly false.
  • Filter the wake_visible_after_launch broadcast by per-lane frontier state, skipping lanes at quiet-completion, with no selected todo, or blocked by quota.
  • Add a synthetic-data smoke test demonstrating the complete stop → takeover → resume operator cycle.

Relevant files or commands

  • loopx/capabilities/auto_research/worker_loop.py
  • loopx/capabilities/auto_research/worker_runtime.py
  • loopx/capabilities/auto_research/demo_e2e.py
  • loopx/capabilities/auto_research/research_state.py (read-only use)
  • examples/auto-research-demo-e2e-worker-loop-smoke.py (style reference)
  • examples/auto-research-worker-turn-smoke.py (style reference)
  • Validation: python examples/auto-research-stop-takeover-walkthrough-smoke.py
  • Boundary scan: loopx check --scan-path examples/ --scan-path loopx/capabilities/auto_research/

Validation plan

  • python -m py_compile loopx/*.py — syntax check
  • python examples/auto-research-demo-e2e-worker-loop-smoke.py — must pass
  • python examples/auto-research-visible-worker-hook-smoke.py — must pass
  • python examples/auto-research-worker-loop-smoke.py — must pass
  • python examples/auto-research-worker-turn-smoke.py — must pass
  • python examples/auto-research-stop-takeover-walkthrough-smoke.py — new smoke, 5 scenarios
  • python examples/showcase-catalog-smoke.py — must pass
  • loopx check --scan-path examples/ --scan-path loopx/capabilities/auto_research/ — zero errors

Public/private boundary

  • [x] This issue does not include private benchmark traces, verifier output, credentials, internal document links, raw agent sessions, or local runtime state.
  • [x] I will not run or duplicate maintainer-owned benchmark cases unless a maintainer explicitly splits out a public task.

rootkiller6788 avatar Aug 05 '26 07:08 rootkiller6788

你好,这是一个 multi agent 实验玩具,暂时不是 loopx 的核心能力,因此欢迎随意改。 如果想做严肃的 auto research,也许可以直接基于 loopx 的核心能力,探索着来做,不一定需要参考这个 multi agent auto research 代码

huangruiteng avatar Aug 05 '26 08:08 huangruiteng

插件机制扩展性够不够 💡

rodriguezrussell93 avatar Aug 06 '26 06:08 rodriguezrussell93

类型提示补全后可读性好多了 📦🤝

rodriguezrussell93 avatar Aug 06 '26 06:08 rodriguezrussell93

🧪📌📦 Mock 和服务虚拟化怎么选

wellsashley00 avatar Aug 06 '26 07:08 wellsashley00

Follow-up for the GH-C43 contributor walkthrough (runtime control transitions already landed in #2786):

https://github.com/huangruiteng/loopx/pull/3658

Adds the operator-facing stop → takeover → resume / state-aware wake walkthrough on the existing command path, plus a thin synthetic smoke. No second launcher.

zyaiire avatar Aug 26 '26 07:08 zyaiire

This issue has had no activity for 90 days, so it is now marked stale as a reminder. It will not be closed automatically.

  • If this is still relevant: reply or update the issue and the stale marker will be removed.
  • If it is no longer needed: close it yourself, or leave a short comment explaining why.

这个 issue 已 90 天没有活动,现仅打上 stale 提醒标记,不会自动关闭。

  • 如果仍然相关:请回复或更新,标记会自动移除。
  • 如果已不需要:请自行关闭,或留言说明原因。

github-actions[bot] avatar Nov 30 '26 11:11 github-actions[bot]