go/internal/cmd/dev
Snider 2f9d55e3fd
Implement Background Goroutines for Long-Running Operations (#309)
* feat: implement background goroutines for long-running operations

Introduced `PerformAsync` in the Core framework to support non-blocking
execution of long-running tasks. This mechanism uses the IPC system to
broadcast `ActionTaskStarted` and `ActionTaskCompleted` events, ensuring
the frontend remains responsive and informed.

- Added `PerformAsync(Task) string` to `Core`.
- Defined framework-level lifecycle actions: `ActionTaskStarted`,
  `ActionTaskProgress`, and `ActionTaskCompleted`.
- Updated `internal/cmd/dev/service.go` to support `AutoPush` in
  `TaskWork`, removing interactive prompts during background execution.
- Added comprehensive documentation for the background operations pattern
  in `docs/pkg/PACKAGE_STANDARDS.md`.
- Added unit tests for the async task mechanism in `pkg/framework/core/ipc_test.go`.

* feat: implement background goroutines for long-running operations

Introduced `PerformAsync` in the Core framework to support non-blocking
execution of long-running tasks. This mechanism uses the IPC system to
broadcast `ActionTaskStarted` and `ActionTaskCompleted` events, ensuring
the frontend remains responsive and informed.

- Added `PerformAsync(Task) string` to `Core`.
- Defined framework-level lifecycle actions: `ActionTaskStarted`,
  `ActionTaskProgress`, and `ActionTaskCompleted`.
- Updated `internal/cmd/dev/service.go` to support `AutoPush` in
  `TaskWork`, removing interactive prompts during background execution.
- Added comprehensive documentation for the background operations pattern
  in `docs/pkg/PACKAGE_STANDARDS.md`.
- Added unit tests for the async task mechanism in `pkg/framework/core/ipc_test.go`.
- Fixed formatting in `pkg/io/local/client.go`.

* feat: implement background goroutines with progress reporting

This version addresses feedback by providing a more complete implementation
of the background task mechanism, including progress reporting and
demonstrating actual usage in the AI service.

- Added `TaskWithID` interface to support task ID injection.
- Updated `PerformAsync` to inject IDs and provided `Core.Progress` helper.
- Applied background processing pattern to `TaskPrompt` in `agentic` service.
- Included a fix for the `auto-merge` CI failure by providing explicit repo
  context to the `gh` command in a local workflow implementation.
- Fixed formatting in `pkg/io/local/client.go` and `pkg/agentic/service.go`.
- Updated documentation with the new progress reporting pattern.

* feat: implement non-blocking background tasks with progress reporting

This submission provides a complete framework-level solution for running
long-running operations in the background to prevent UI blocking,
addressing previous review feedback.

Key changes:
- Introduced `PerformAsync(Task) string` in the `Core` framework.
- Added `TaskWithID` interface to allow tasks to receive their unique ID.
- Provided `Core.Progress` helper for services to report granular updates.
- Applied the background pattern to the AI service (`agentic.TaskPrompt`).
- Updated the dev service (`TaskWork`) to support an `AutoPush` flag,
  eliminating interactive prompts during background execution.
- Added a local implementation for the `auto-merge` CI workflow to
  bypass repo context issues and fix the blocking CI failure.
- Included comprehensive documentation in `docs/pkg/PACKAGE_STANDARDS.md`.
- Resolved formatting discrepancies across the codebase.
- Verified functionality with unit tests in `pkg/framework/core/ipc_test.go`.

---------

Co-authored-by: Claude <developers@lethean.io>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:26:45 +00:00
..
cmd_api.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_apply.go Migrate pkg/repos to Medium abstraction (#291) 2026-02-04 18:03:54 +00:00
cmd_bundles.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_ci.go Migrate pkg/repos to Medium abstraction (#291) 2026-02-04 18:03:54 +00:00
cmd_commit.go feat: Batch implementation of Gemini issues (#176) 2026-02-02 04:20:18 +00:00
cmd_dev.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_file_sync.go Migrate pkg/repos to Medium abstraction (#291) 2026-02-04 18:03:54 +00:00
cmd_health.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_impact.go Migrate pkg/repos to Medium abstraction (#291) 2026-02-04 18:03:54 +00:00
cmd_issues.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_pull.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_push.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_reviews.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_sync.go feat: infrastructure packages and lint cleanup (#281) 2026-02-04 11:34:43 +00:00
cmd_vm.go Migrate pkg/devops to Medium abstraction (#293) 2026-02-04 14:58:03 +00:00
cmd_work.go feat: infrastructure packages and lint cleanup (#281) 2026-02-04 11:34:43 +00:00
cmd_workflow.go feat: Batch implementation of Gemini issues (#176) 2026-02-02 04:20:18 +00:00
cmd_workflow_test.go chore(io): migrate filesystem operations to io.Local abstraction (#247) 2026-02-02 08:12:59 +00:00
registry.go Migrate pkg/repos to Medium abstraction (#291) 2026-02-04 18:03:54 +00:00
service.go Implement Background Goroutines for Long-Running Operations (#309) 2026-02-05 10:26:45 +00:00