Skip to content

feat(tool): add automate_manage lifecycle actions - #1278

Merged
Astro-Han merged 14 commits into
devfrom
codex/i1249-automate-manage
Jun 17, 2026
Merged

feat(tool): add automate_manage lifecycle actions#1278
Astro-Han merged 14 commits into
devfrom
codex/i1249-automate-manage

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a deferred automate_manage tool for listing, pausing, resuming, and deleting existing PawWork Automations by exact id.

Also tightens the permission surfaces exposed by this new delete flow: delete confirmation shows the automation title/id, one-time-only prompts no longer show an unavailable "allow always" choice in the app or ACP, and model routing now points existing automation management requests to automate_manage via tool_info.

Why

Users can create Automations from conversation with automate, but issue #1249 tracks the missing management side: seeing existing automation ids, reversible pause/resume, and deletion without falling back to shell or OS scheduler workflows.

Related Issue

Closes #1249

Human Review Status

Pending

Review Focus

Please focus on the management contract: list stays current-scope, pause/resume do not ask, delete asks through ctx.ask before removal, live active-run deletion preserves the existing 409-style behavior as a readable tool error, and once-only delete prompts do not offer persistent approval.

Risk Notes

Deletion is destructive, so the tool gates it through ctx.ask and exact ids. The delete permission is intentionally one-time-only because automate_manage delete passes no always patterns. The app permission dock and ACP now hide the persistent approval option whenever a request cannot persist approval.

Pause/resume are reversible and follow the existing server route behavior by publishing definition updates instead of adding a separate scheduler path. The visible UI change is limited to the permission dock copy/buttons. The platform/permissions impact is shared app renderer and ACP behavior only; no OS-specific packaging, updater, signing, installer, or filesystem path behavior changed.

How To Verify

Focused opencode tests: bun --cwd packages/opencode test test/tool/automate-manage.test.ts test/tool/tool-info.test.ts test/tool/registry.test.ts test/acp/event-subscription.test.ts -> 102 pass, 0 fail
Automation delete/update follow-up tests: bun --cwd packages/opencode test test/tool/automate-manage.test.ts test/server/automation-scheduler.test.ts -> 61 pass, 0 fail
Prompt-loop activation smoke: bun --cwd packages/opencode test test/session/prompt-effect.test.ts -t "loop activates automate_manage through tool_info before invoking it" -> 1 pass, verifies the model-facing tool surface goes from tool_info-only to automate_manage callable before executing list
Opencode typecheck: (cd packages/opencode && bun run typecheck) -> tsgo --noEmit passed
App permission helper test: (cd packages/app && bun test --preload ./happydom.ts ./src/pages/session/composer/session-permission-dock.test.ts) -> 3 pass, 0 fail
App typecheck: (cd packages/app && bun run typecheck) -> tsgo -b passed
Permission dock snap: (cd packages/app && bun run snap permission-dock) -> 1 pass, generated docs/design/preview/screenshots/permission-dock.png for local visual review
Diff check: git diff --check and git diff --cached --check -> no whitespace errors

Screenshots or Recordings

Local snap generated and visually reviewed at docs/design/preview/screenshots/permission-dock.png. It shows automate_manage delete confirmation with automation title/id and no Allow always button, plus a normal persistable shell permission that still shows Allow always.

Checklist

How to use this checklist:

  • Tick a box by replacing [ ] with [x]. Do not edit, add, or remove items.
  • The bot-applied label items can only be honestly ticked AFTER the PR is opened and the labeler / priority-triage bots have run — return to the PR description and tick them then.
  • Most items are required. The few that are conditional are explicitly marked (conditional); for those, leave unticked if they truly do not apply and explain why in Risk Notes. All other items must be ticked before requesting human review.
  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

Summary by CodeRabbit

  • New Features

    • Introduced an automation management tool to list, pause, resume, and delete automations via conversation.
  • UI

    • Permission prompt now shows metadata lines for automation deletions and only offers "Allow always" when persistence is permitted.
    • Added a permission-dock fixture and snapshot for visual verification.
  • Localization

    • Added English and Chinese strings for automate-manage deletion prompts.
  • Tests

    • Expanded tests for automation management, scheduler behavior, registry/deferred-tool handling, and permission flows.

@Astro-Han Astro-Han added enhancement New feature or request P2 Medium priority harness Model harness, prompts, tool descriptions, and session mechanics labels Jun 12, 2026

@github-actions github-actions 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.

Suggested priority: P2 (includes non-doc, non-test paths outside the low-risk bucket).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/i1249-automate-manage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces the automate_manage tool, which allows listing, pausing, resuming, and deleting existing PawWork Automations. It includes the tool definition, integration into the tool registry and info modules, and comprehensive unit tests. The feedback suggests improving error handling in the tool's execution flow by leveraging the Effect ecosystem's error channel (using Effect.fail and Effect.succeed instead of throwing synchronous errors).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/opencode/src/tool/automate-manage.ts
Comment thread packages/opencode/src/tool/automate-manage.ts Outdated

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/opencode/src/tool/tool-info.ts`:
- Around line 69-75: The tool_info entry for the automate_manage tool does not
fully document the activation-time contract: update the description string for
the automate_manage object (the one with id "automate_manage" and parameters
cast to Tool.Def["parameters"]) to explicitly state that "list" operations are
limited to the current context only and that pause, resume, and delete
operations require an exact automation id (no fuzzy matching); keep the existing
user-facing guidance but extend the deferred description to enumerate these
constraints so the pre-activation model cannot assume global listing or allow
fuzzy id targets.

In `@packages/opencode/test/tool/automate-manage.test.ts`:
- Around line 1-196: The suite currently creates a manual ManagedRuntime
(ManagedRuntime, runtime, and the await runtime.runPromise(...) that yields
automation) and uses plain bun:test test(...) cases; replace that wiring by
converting tests to use the repository test harness (testEffect) and run
OS-backed scenarios with it.live(...), remove the
ManagedRuntime/runtime/automation manual setup and instead obtain the Automation
service via the testEffect provided layer (use Automation.defaultLayer or the
harness's layer composition), and update each test case to run as testEffect +
it.live so Effect services (e.g., createAutomateManageDefinition,
AutomationScheduler interactions, Flock/tmpdir) are executed under the standard
Effect test environment rather than custom runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c3ad70b-c5f8-45d3-b4dd-bdfb747c3037

📥 Commits

Reviewing files that changed from the base of the PR and between a143f92 and 8393bf4.

📒 Files selected for processing (6)
  • packages/opencode/src/tool/automate-manage.ts
  • packages/opencode/src/tool/registry.ts
  • packages/opencode/src/tool/tool-info.ts
  • packages/opencode/test/tool/automate-manage.test.ts
  • packages/opencode/test/tool/registry.test.ts
  • packages/opencode/test/tool/tool-info.test.ts

Comment thread packages/opencode/src/tool/tool-info.ts
Comment thread packages/opencode/test/tool/automate-manage.test.ts
@github-actions github-actions Bot added app Application behavior and product flows ui Design system and user interface labels Jun 12, 2026

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/opencode/src/tool/automate-manage.ts`:
- Around line 101-103: The update path for pause/resume currently calls
automation.update(id, { paused: ... }) after reading previous and can surface a
raw NotFound; wrap or replace that call with the same readable stale-id mapping
used elsewhere so a removed definition produces the friendly "automate_manage
list" guidance instead of a raw error—i.e., intercept errors from
automation.update (in automate-manage.ts around the params.action ===
"pause"/"resume" branch), detect the not-found/stale-id case and re-throw or
return the mapped, human-friendly error message used elsewhere (preserving the
existing revision check against previous.revision).

In `@packages/opencode/test/session/prompt-effect.test.ts`:
- Around line 1040-1044: Add an explicit assertion on the number of emitted
requests before indexing into requests: after collecting const requests = yield*
llm.inputs, assert the expected count (e.g., expect(requests).toHaveLength(2) or
expect(requests.length).toBeGreaterThanOrEqual(2)) so the subsequent positional
checks that call requestToolNames(requests[0]) and requestToolNames(requests[1])
fail with a clear message if fewer requests were emitted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c8f27aba-d8cb-4d92-8b42-541de9f443e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8393bf4 and d3bb3d1.

📒 Files selected for processing (16)
  • packages/app/e2e/snap/fixtures/permission-dock-fixture.tsx
  • packages/app/e2e/snap/permission-dock.snap.ts
  • packages/app/src/i18n/en.ts
  • packages/app/src/i18n/zh.ts
  • packages/app/src/pages/session/composer/session-permission-dock.test.ts
  • packages/app/src/pages/session/composer/session-permission-dock.tsx
  • packages/opencode/src/acp/agent.ts
  • packages/opencode/src/session/prompt/pawwork.txt
  • packages/opencode/src/tool/automate-manage.ts
  • packages/opencode/src/tool/shell.txt
  • packages/opencode/src/tool/tool-info.ts
  • packages/opencode/test/acp/event-subscription.test.ts
  • packages/opencode/test/server/automation-scheduler.test.ts
  • packages/opencode/test/session/prompt-effect.test.ts
  • packages/opencode/test/tool/automate-manage.test.ts
  • packages/opencode/test/tool/registry.test.ts
✅ Files skipped from review due to trivial changes (3)
  • packages/opencode/src/tool/shell.txt
  • packages/app/src/i18n/zh.ts
  • packages/app/src/i18n/en.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/opencode/src/tool/tool-info.ts
  • packages/opencode/test/tool/registry.test.ts

Comment thread packages/opencode/src/tool/automate-manage.ts
Comment thread packages/opencode/test/session/prompt-effect.test.ts
@Astro-Han
Astro-Han merged commit 1853718 into dev Jun 17, 2026
36 checks passed
@Astro-Han
Astro-Han deleted the codex/i1249-automate-manage branch June 17, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows enhancement New feature or request harness Model harness, prompts, tool descriptions, and session mechanics P2 Medium priority ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] automate_manage tool: list, pause, resume, and delete Automations from conversation

1 participant