Skip to content

loop: add reload_runtime tool and auto-resume on /reload#45

Open
yuanhaorannnnnn wants to merge 1 commit into
mitsuhiko:mainfrom
yuanhaorannnnnn:loop-reload-auto-resume
Open

loop: add reload_runtime tool and auto-resume on /reload#45
yuanhaorannnnnn wants to merge 1 commit into
mitsuhiko:mainfrom
yuanhaorannnnnn:loop-reload-auto-resume

Conversation

@yuanhaorannnnnn
Copy link
Copy Markdown

When running a loop that modifies extension files, the agent previously had no way to trigger reload. After a manual /reload, the loop state was restored but the loop did not resume automatically.

This adds:

  • reload_runtime tool: LLM-callable, queues /reload-runtime as followUp
  • reload-runtime command: executes ctx.reload() (only available in CommandContext)
  • Auto-resume: on session_start with reason="reload" and active loop, automatically triggers the next loop prompt

The LLM can now modify extensions during a loop, call reload_runtime, and the loop automatically continues with the new code loaded.

Flow

Agent modifies .ts extension file
  -> calls reload_runtime tool
  -> followUp queues "/reload-runtime"
  -> current turn completes, agent idle
  -> Command handler calls ctx.reload()
  -> session_shutdown -> session_start (reason: reload)
  -> restoreLoopState() recovers loop state
  -> triggerLoopPrompt() auto-resumes loop

When running a loop that modifies extension files, the agent previously
had no way to trigger reload. After a manual /reload, the loop state was
restored but the loop did not resume automatically.

This adds:
- reload_runtime tool: LLM-callable, queues "/reload-runtime" as followUp
- reload-runtime command: executes ctx.reload() (only available in CommandContext)
- Auto-resume: on session_start with reason="reload" and active loop, resume

The LLM can now modify extensions during a loop, trigger reload, and the
loop automatically continues with the new code loaded.
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.

1 participant