Skip to content

✨ refactor(agent-signal): add executeViaExecAgent self-iteration shell#15192

Closed
arvinxx wants to merge 1 commit into
canaryfrom
feat/agent-signal-execute-via-exec-agent
Closed

✨ refactor(agent-signal): add executeViaExecAgent self-iteration shell#15192
arvinxx wants to merge 1 commit into
canaryfrom
feat/agent-signal-execute-via-exec-agent

Conversation

@arvinxx

@arvinxx arvinxx commented May 25, 2026

Copy link
Copy Markdown
Member

πŸ’» Change Type

  • ✨ feat
  • βœ… test

πŸ”— Related Issue

Part of LOBE-9434 (parent), LOBE-9454.

Supersedes the Phase 2 piece of #15116 (that PR will be closed; see comment there for context).

πŸ”€ Description of Change

Phase 2 of LOBE-9434: introduces executeViaExecAgent as the async-queue
replacement for executeSelfIteration. Builds on the Phase 1 plumbing
landed in #15187.

Not wired into any caller yet β€” the review / reflection / feedback
handlers continue to call executeSelfIteration directly. Migration of
each caller happens in Phase 3, one at a time, so each cutover is
independently revertable.

What it does:

  • Builds the self-iteration prompt via the shared
    createAgentSignalSelfIterationPrompt
  • Routes through AiAgentService.execAgent with the self-iteration
    builtin slug and suppressSignal: true so the run cannot recurse
    into AgentSignal (shouldSuppressSignal from Phase 1 enforces this)
  • Caller-supplied window overrides the context-derived defaults

What it does NOT do:

  • Does not touch executeSelfIteration in execute.ts
  • Does not change any registered source/signal/action handler
  • Does not affect any UI or cron path

πŸ§ͺ How to Test

  • Tested locally β€” bun run type-check clean
  • Added 5 unit tests covering happy path, default mode, window
    precedence, context fallback, and enqueue-failure surfacing
bunx vitest run --silent='passed-only' 'executeViaExecAgent.test.ts'

πŸ“ Additional Information

Safe to merge: zero callers reference the new function until Phase 3,
so this is dormant code on the day it lands. Cloud impact: none.

Next: Phase 3 F (userMemory.ts migration to execAgent) β€” the
high-risk piece β€” will be a separate dedicated PR so it can be reviewed
and reverted on its own.

Phase 2 of LOBE-9434: introduces `executeViaExecAgent` as the
async-queue replacement for `executeSelfIteration` (LOBE-9454).

- Builds the self-iteration prompt via the shared `createAgentSignalSelfIterationPrompt`
- Routes through `AiAgentService.execAgent` with the `self-iteration` builtin
  slug and `suppressSignal: true` so the run cannot recurse into AgentSignal
- Caller-supplied window overrides the context-derived defaults

Not yet wired into any caller β€” the review / reflection / feedback handlers
keep calling `executeSelfIteration` directly. Migration of each caller
happens in Phase 3.

Tests: 5 unit tests covering happy path, default mode, window precedence,
context fallback, and enqueue-failure surfacing.
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 25, 2026
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Ready Ready Preview, Comment May 25, 2026 4:49am

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @arvinxx, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e560c34aba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

autoStart: true,
maxSteps: input.maxSteps,
prompt,
slug: BUILTIN_AGENT_SLUGS.selfIteration,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ensure self-iteration tools are actually available

This enqueues the builtin self-iteration agent by slug, but does not provide the agent-signal-self-iteration tool manifest/executor that the agent depends on. In this repo, that identifier is referenced by the builtin agent runtime (packages/builtin-agents/src/agents/self-iteration/index.ts) but is not registered in the builtin tools list (packages/builtin-tools/src/index.ts only wires selfFeedbackIntentManifest from that package), and AgentToolsEngine drops unknown tool IDs. As a result, once callers migrate to this helper, runs can start without the self-iteration read/write tool surface, so proposal/write behavior will silently fail to execute.

Useful? React with πŸ‘Β / πŸ‘Ž.

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 70.92%. Comparing base (3c52998) to head (e560c34).

Additional details and impacted files
@@            Coverage Diff            @@
##           canary   #15192     +/-   ##
=========================================
  Coverage   70.92%   70.92%             
=========================================
  Files        3152     3153      +1     
  Lines      314060   314099     +39     
  Branches    28568    34277   +5709     
=========================================
+ Hits       222738   222777     +39     
  Misses      91154    91154             
  Partials      168      168             
Flag Coverage Ξ”
app 61.79% <100.00%> (+<0.01%) ⬆️
database 92.20% <ΓΈ> (ΓΈ)
packages/agent-runtime 80.48% <ΓΈ> (ΓΈ)
packages/builtin-tool-lobe-agent 19.87% <ΓΈ> (ΓΈ)
packages/context-engine 84.13% <ΓΈ> (ΓΈ)
packages/conversation-flow 91.28% <ΓΈ> (ΓΈ)
packages/file-loaders 87.89% <ΓΈ> (ΓΈ)
packages/memory-user-memory 74.99% <ΓΈ> (ΓΈ)
packages/model-bank 99.99% <ΓΈ> (ΓΈ)
packages/model-runtime 83.88% <ΓΈ> (ΓΈ)
packages/prompts 72.54% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (ΓΈ)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (ΓΈ)
packages/types 35.07% <ΓΈ> (ΓΈ)
packages/utils 88.47% <ΓΈ> (ΓΈ)
packages/web-crawler 88.08% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 68.02% <ΓΈ> (ΓΈ)
Services 54.68% <ΓΈ> (ΓΈ)
Server 72.19% <100.00%> (+0.01%) ⬆️
Libs 56.77% <ΓΈ> (ΓΈ)
Utils 85.96% <ΓΈ> (ΓΈ)
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx changed the title ✨ feat(agent-signal): add executeViaExecAgent self-iteration shell [LOBE-9434 Phase 2] ✨ feat(agent-signal): add executeViaExecAgent self-iteration shell May 25, 2026
@arvinxx arvinxx changed the title ✨ feat(agent-signal): add executeViaExecAgent self-iteration shell ✨ refactor(agent-signal): add executeViaExecAgent self-iteration shell May 25, 2026
@arvinxx

arvinxx commented May 25, 2026

Copy link
Copy Markdown
Member Author

Closing this PR β€” superseded by a different architectural direction.

Context: The shell here was built around a single self-iteration slug, inheriting the consolidation done in commit 627f899 (which itself was reverted into one slug from the originally-three-slug design of PR #15116's early commits). On deeper review, that consolidation conflicted with the standard builtin tool contract:

  • agent-signal-self-iteration declared one plugin identifier, but its runtime behavior dispatched on mode (review / reflection / feedback) via adapter closures β€” different reserveOperation / writeReceipt / preflight per mode. Same identifier, three behaviors.
  • This was a deliberate design choice in PR ♻️ refactor(agent-signal,prompts,database,builtin-tool-self-iteration): unified structure of service, unified tool, unified name and conceptsΒ #14699 ("unified structure / unified tool / unified name and concepts"), with no recorded rationale in the PR body. Inferred motivations: code dedup in tools/shared.ts, a single ergonomic surface, easy mode addition.
  • It worked only because executeSelfIteration bypasses plugin lookup (manually constructing AgentState.operationToolSet). Once we try to route through execAgent (standard plugin lookup), one identifier = one behavior becomes a load-bearing contract that the consolidation violates.
  • Per-mode receipt tables, idempotency Redis namespaces, brief projection paths are genuinely independent β€” they're three audit pipelines, not one.

New direction (see follow-up PR):

  1. Restore 3 agent slugs: nightly-review, self-reflection, self-feedback-intent
  2. Each declares its own tool identifier: agent-signal-review, agent-signal-reflection, agent-signal-feedback-intent
  3. Shared scaffolding (tools/shared.ts's idempotency / preflight / receipt span) extracted to a shared module β€” PR ♻️ refactor(agent-signal,prompts,database,builtin-tool-self-iteration): unified structure of service, unified tool, unified name and conceptsΒ #14699's dedup value preserved
  4. Each tool gets its own ExecutionRuntime constructor-injected with mode-specific service (one-shot at boot, matching the selfFeedbackIntent.ts pattern)
  5. Per-execution sourceId + evidenceRefs flow through appContext, the only state still threaded per call

Next PR will start by restoring the 3 slugs (dormant agents with empty plugins). Tool package implementation comes after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:agent Assistant/Agent configuration and behavior size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant