Skip to content

feat: add built-in tools for creating and updating internal loops#1046

Open
aj47 wants to merge 4 commits into
feature/1013-terminal-session-fill-vertical-spacefrom
codex/internal-loop-tools
Open

feat: add built-in tools for creating and updating internal loops#1046
aj47 wants to merge 4 commits into
feature/1013-terminal-session-fill-vertical-spacefrom
codex/internal-loop-tools

Conversation

@aj47

@aj47 aj47 commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a new persisted InternalLoop model and config.internalLoops
  • add built-in tool definitions for:
    • speakmcp-settings:list_loops
    • speakmcp-settings:create_loop
    • speakmcp-settings:update_loop
  • implement handlers with validation, uniqueness checks, config persistence, and JSON responses

Testing

  • pnpm --filter @speakmcp/desktop typecheck

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@augmentcode

augmentcode Bot commented Feb 18, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds built-in SpeakMCP settings tools to manage persisted “internal loops” (recurring task definitions) in the desktop app.

Changes:

  • Introduces a shared InternalLoop model and persists loops via Config.internalLoops.
  • Adds new tool schemas for speakmcp-settings:list_loops, speakmcp-settings:create_loop, and speakmcp-settings:update_loop.
  • Implements handlers that validate inputs, enforce case-insensitive unique loop names, and return structured JSON results.
  • Initializes desktop config defaults with internalLoops: [] to ensure persistence works out of the box.
  • Generates loop IDs with UUIDs and maintains createdAt/updatedAt timestamps for auditing.

Why: Enables agents/users to discover, create, and update recurring task definitions via MCP tool calls instead of manually editing configuration.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode 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.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread apps/desktop/src/main/builtin-tools.ts Outdated
}

const config = configStore.get()
const loops = config.internalLoops || []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

config.json is user-editable and is spread over defaults, so config.internalLoops could be non-array (e.g., null/object), which would crash on .find/spread. Consider guarding with Array.isArray(config.internalLoops) (defaulting to []) in list_loops, create_loop, and update_loop.

Severity: medium

Other Locations
  • apps/desktop/src/main/builtin-tools.ts:959
  • apps/desktop/src/main/builtin-tools.ts:1108

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@aj47

aj47 commented Feb 18, 2026

Copy link
Copy Markdown
Owner Author

augment review

@augmentcode augmentcode 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.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

description: "Task prompt to run for this loop",
},
intervalMinutes: {
type: "number",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

intervalMinutes is declared as type: "number" in the tool schema, but the handlers reject non-integers via Number.isInteger. Consider making the schema type: "integer" (and setting minimum: 1) so callers don’t send floats and immediately hit validation errors.

Severity: low

Other Locations
  • apps/desktop/src/main/builtin-tool-definitions.ts:301

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread apps/desktop/src/main/builtin-tools.ts Outdated

const now = Date.now()
const loop: InternalLoop = {
id: `loop_${now}_${Math.random().toString(36).substr(2, 9)}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The loop id generation uses Date.now() + Math.random() and substr, which can (rarely) collide or even produce an empty random suffix, breaking update_loop’s ability to uniquely identify loops. Consider using a UUID (or similar) to make IDs reliably unique and avoid deprecated string APIs.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@aj47

aj47 commented Feb 18, 2026

Copy link
Copy Markdown
Owner Author

augment review

@augmentcode augmentcode 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.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

const name = args.name.trim()
const prompt = args.prompt.trim()

const existingLoop = loops.find((loop) => loop.name.toLowerCase() === name.toLowerCase())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since config.json is user-editable, internalLoops elements could be null/non-objects; accessing loop.name.toLowerCase() (and loop.id) would throw and crash the tool handler. Consider sanitizing/filtering entries in getInternalLoops so these handlers are resilient to malformed stored loop entries.

Severity: medium

Other Locations
  • apps/desktop/src/main/builtin-tools.ts:1114
  • apps/desktop/src/main/builtin-tools.ts:1132

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@aj47

aj47 commented Feb 18, 2026

Copy link
Copy Markdown
Owner Author

augment review

@augmentcode augmentcode 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.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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