Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions coding-agent/docs/adr/0044-bee-launch-surfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,14 @@ Keep deferred:
- [x] `test_bee_task_lifecycle_resume_retry_cancel_abort`
- [x] `test_scheduled_bee_launch_creates_task_and_links_schedule`
- [x] `test_proactive_signal_bee_launch_creates_task_and_links_signal`
- [ ] `test_console_bee_launch_renders_safe_launch_summary`
- [ ] `test_bee_launch_metrics_omit_high_cardinality_ids`
- [ ] `test_bee_launch_e2e_smoke`
- [x] `test_console_bee_launch_renders_safe_launch_summary`
- [x] `test_console_bee_launch_renders_durable_launch_store_summary`
- [x] `test_observability_platform_bee_launch_metrics_are_low_cardinality`
- [x] `test_bee_launch_e2e_smoke`
- [x] `uv run pytest tests/coding_agent/test_bee_launch.py -v`
- [x] `uv run pytest tests/coding_agent/test_scheduled_runs.py -v`
- [ ] `uv run pytest tests/ui/test_developer_console.py -v`
- [ ] `git diff --check -- .`
- [x] `uv run pytest tests/ui/test_developer_console.py -v`
- [x] `git diff --check -- .`

## References

Expand Down
82 changes: 82 additions & 0 deletions coding-agent/docs/bee_launch/GOAL_PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,85 @@ This ledger tracks G118-G126 for the Bee Launch / Scheduled Bee Task Integration
- Proactive replay validates existing launch source, signal_id, session_id, and topic_id before returning an existing result.
- Remaining risks:
- Console launch views and launch metrics remain pending.

## G126_BEE_LAUNCH_CONSOLE_OBSERVABILITY_E2E

### Before

- Goal id: G126_BEE_LAUNCH_CONSOLE_OBSERVABILITY_E2E
- Intended files:
- `docs/bee_launch/GOAL_PROGRESS.md`
- `docs/bee_launch/IMPLEMENTATION_REPORT.md`
- `docs/bee_launch/USAGE.md`
- `docs/adr/0044-bee-launch-surfaces.md`
- `src/coding_agent/bee_launch.py`
- `src/coding_agent/observability.py`
- `src/coding_agent/ui/developer_console.py`
- `src/coding_agent/ui/http_server.py`
- `tests/coding_agent/test_bee_launch.py`
- `tests/coding_agent/test_observability_platform_smoke.py`
- `tests/ui/test_developer_console.py`
- Verification commands:
- `uv run pytest tests/coding_agent/test_bee_launch.py -v`
- `uv run pytest tests/coding_agent/test_observability_platform_smoke.py -v`
- `uv run pytest tests/ui/test_developer_console.py -v`
- `uv run pytest tests/coding_agent/test_bee_command_bridge.py -v`
- `uv run pytest tests/coding_agent/test_bee_workspace.py -v`
- `uv run pytest tests/coding_agent/test_bee_runtime.py -v`
- `uv run pytest tests/coding_agent/test_scheduled_runs.py -v`
- `uv run pytest tests/coding_agent/test_topic_layer_smoke.py -v`
- `uv run pytest tests/integration/test_durable_runtime_smoke.py -v`
- `uv run pytest tests/coding_agent/test_context_system_smoke.py -v`
- `uv run pytest tests/coding_agent/action_safety/test_safe_action_smoke.py -v`
- `uv run ruff format --check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py`
- `uv run ruff check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py`
- `git diff --check -- .`
- Stop criteria:
- Console Bee page renders safe launch list/detail summary with launch source, status, and linked template/task/topic/schedule/signal fields.
- Prometheus launch metrics use only low-cardinality source/status/kind labels.
- Manual, scheduled, proactive, lifecycle, and safety smoke coverage remains deterministic.
- Final implementation and usage docs exist.
- No external executor, homelab-specific, Argo/K8s, nmem, desktop, bridge, or multi-agent work is introduced.

### After

- Changed files:
- `docs/bee_launch/GOAL_PROGRESS.md`
- `docs/bee_launch/IMPLEMENTATION_REPORT.md`
- `docs/bee_launch/USAGE.md`
- `docs/adr/0044-bee-launch-surfaces.md`
- `src/coding_agent/bee_launch.py`
- `src/coding_agent/observability.py`
- `src/coding_agent/ui/developer_console.py`
- `src/coding_agent/ui/http_server.py`
- `tests/coding_agent/test_bee_launch.py`
- `tests/coding_agent/test_observability_platform_smoke.py`
- `tests/ui/test_developer_console.py`
- Tests run:
- `uv run pytest tests/coding_agent/test_bee_launch.py -q`
- `uv run pytest tests/coding_agent/test_observability_platform_smoke.py -q`
- `uv run pytest tests/ui/test_developer_console.py -q`
- `uv run pytest tests/coding_agent/test_bee_command_bridge.py -q`
- `uv run pytest tests/coding_agent/test_bee_workspace.py -q`
- `uv run pytest tests/coding_agent/test_bee_runtime.py -q`
- `uv run pytest tests/coding_agent/test_scheduled_runs.py -q`
- `uv run pytest tests/coding_agent/test_topic_layer_smoke.py -q`
- `uv run pytest tests/integration/test_durable_runtime_smoke.py -q`
- `uv run pytest tests/coding_agent/test_context_system_smoke.py -q`
- `uv run pytest tests/coding_agent/action_safety/test_safe_action_smoke.py -q`
- `uv run pytest tests/coding_agent/evaluation/ -q`
- `uv run pytest tests/dogfood/test_workspace_provider_demo.py -q`
- `uv run pytest tests/agentkit/runtime/test_pipeline.py -k "build_context or runtime_stage_spans" -q`
- `uv run pytest tests/coding_agent/test_observability.py -q`
- `uv run pytest tests/coding_agent/test_observability_local_stack.py -q`
- `uv run ruff format --check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py`
- `uv run ruff check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py`
- `git diff --check -- .`
- Results:
- Console Bee page now renders Bee launch summaries from the durable Bee launch store, with run metadata as fallback, including launch source, status, template, task, topic, schedule, signal, and safe error fields.
- Launch orchestration records fail-open Prometheus launch metrics, and Prometheus exposes `bee_launches_total`, `bee_launch_duration_seconds`, `scheduled_bee_launches_total`, and `proactive_bee_launches_total` using only low-cardinality labels.
- Added final Bee launch smoke coverage across manual, scheduled, and proactive launch paths.
- Added final Bee launch usage and implementation report documentation.
- Remaining risks:
- Console launch visibility is list-oriented; a deeper per-launch detail route can be added later without changing launch semantics.
- External executor adapters remain intentionally deferred.
66 changes: 66 additions & 0 deletions coding-agent/docs/bee_launch/IMPLEMENTATION_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Bee Launch Implementation Report

## Scope

G118-G126 completed the Bee Launch / Scheduled Bee Task Integration phase.
The phase adds a safe, durable, topic-aware launch surface for manual,
scheduled, and proactive Bee task creation.

The implementation stays in the Coding Agent product layer. AgentKit Core,
durable runtime semantics, topic semantics, workspace policy, action safety,
Bee command bridge behavior, and observability contracts remain unchanged.

## Landed Goals

- G118 mapped current Bee runtime, workspace contract, command bridge, schedule,
proactive signal, console, and observability surfaces.
- G119 accepted ADR-0044 for Bee launch surfaces.
- G120 added durable Bee launch records and store behavior.
- G121 added workspace template resolution and input binding.
- G122 added manual Bee launch through the product-layer orchestrator.
- G123 added bounded resume, retry, cancel, and abort lifecycle controls.
- G124 connected schedules to Bee launch.
- G125 connected proactive signals to Bee launch.
- G126 added console launch visibility, low-cardinality launch metrics, final
smoke coverage, and usage documentation.

## Safety Boundaries

- Launch does not execute arbitrary commands.
- Bee nodes remain evidence-gated and policy-bound through the Bee command
bridge before execution.
- Schedules and proactive signals cannot bypass command policy, workspace
policy, action safety, validation, approval, or HITL.
- Prometheus metrics do not use `launch_id`, `task_id`, `topic_id`, `run_id`,
`session_id`, `schedule_id`, `signal_id`, or `node_id` labels.
- Console output avoids raw prompt, message, content, command output, stdout,
stderr, env, and secrets.
- The Developer Console reads durable Bee launch records when a PG store is
configured and falls back to sanitized run metadata otherwise.

## Verification

Primary verification commands for the final state:

```bash
uv run pytest tests/coding_agent/test_bee_launch.py -v
uv run pytest tests/coding_agent/test_observability_platform_smoke.py -v
uv run pytest tests/ui/test_developer_console.py -v
uv run pytest tests/coding_agent/test_bee_command_bridge.py -v
uv run pytest tests/coding_agent/test_bee_workspace.py -v
uv run pytest tests/coding_agent/test_bee_runtime.py -v
uv run pytest tests/coding_agent/test_scheduled_runs.py -v
uv run pytest tests/coding_agent/test_topic_layer_smoke.py -v
uv run pytest tests/integration/test_durable_runtime_smoke.py -v
uv run pytest tests/coding_agent/test_context_system_smoke.py -v
uv run pytest tests/coding_agent/action_safety/test_safe_action_smoke.py -v
uv run ruff format --check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py
uv run ruff check src/coding_agent/bee_launch.py src/coding_agent/observability.py src/coding_agent/ui/developer_console.py src/coding_agent/ui/http_server.py tests/coding_agent/test_bee_launch.py tests/coding_agent/test_observability_platform_smoke.py tests/ui/test_developer_console.py
git diff --check -- .
```

## Deferred

External executor adapters, Docker/Kubernetes/Argo execution, Argo CD
integration, nmem integration, homelab-specific templates, desktop app, bridge,
and multi-agent task graph remain out of scope.
83 changes: 83 additions & 0 deletions coding-agent/docs/bee_launch/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Bee Launch Usage

Bee launch is the product-layer entry point for starting workspace-local Bee
tasks. It resolves a `.bee/templates/<template_id>` template, binds safe inputs,
creates or continues a Topic, creates a durable BeeTask, and writes `task.json`
when workspace artifacts are enabled.

Launch itself does not execute command intents. Bee nodes remain pending until
execution goes through the Bee command bridge, workspace binding, command policy,
action safety, validation, and HITL where required.

## Launch Sources

- Manual launch uses `BeeLaunchOrchestrator.launch_manual()`.
- Scheduled launch uses `ScheduledBeeLaunchOrchestrator.launch_due()`.
- Proactive signal launch uses `ProactiveBeeLaunchOrchestrator.launch_signal()`.

All launch sources create a `BeeLaunchRecord` with `launch_id`, `source`,
`template_id`, `status`, optional `task_id`, optional `topic_id`, and optional
schedule or signal linkage.

## Lifecycle Controls

`BeeTaskLifecycleController` provides bounded controls:

- `resume_task()` marks only incomplete ready work for continuation.
- `retry_node()` retries failed nodes and preserves prior evidence.
- `cancel_task()` records a cancelled terminal task.
- `abort_task()` records an aborted terminal task and preserves task metadata.

Lifecycle controls do not execute commands and do not bypass existing safety
policy.

## Console

The Developer Console Bee page is available at:

```text
/console/bee
```

It shows Bee tasks, node launches, workspace templates, workspace run artifacts,
command intents, and Bee launch summaries. Launch summaries include source,
status, template, task, topic, schedule, and signal links where available. Raw
prompt, message, command output, stdout, stderr, env, and secrets are not
rendered.

When PostgreSQL-backed stores are configured, launch summaries come from the
durable Bee launch store. In local fixture mode the console can still fall back
to sanitized run metadata.

## Metrics

Bee launch metrics are low cardinality:

```text
bee_launches_total{source,status}
bee_launch_duration_seconds{source,status}
scheduled_bee_launches_total{status}
proactive_bee_launches_total{kind,status}
```

Identifier labels such as `launch_id`, `task_id`, `topic_id`, `run_id`,
`session_id`, `schedule_id`, `signal_id`, and `node_id` are intentionally not
exported.

## Verification

Representative local checks:

```bash
uv run pytest tests/coding_agent/test_bee_launch.py -v
uv run pytest tests/coding_agent/test_observability_platform_smoke.py -v
uv run pytest tests/ui/test_developer_console.py -v
uv run pytest tests/coding_agent/test_bee_command_bridge.py -v
uv run pytest tests/coding_agent/test_bee_workspace.py -v
uv run pytest tests/coding_agent/test_bee_runtime.py -v
uv run pytest tests/coding_agent/test_scheduled_runs.py -v
git diff --check -- .
```

External executor, Kubernetes, Argo, nmem, desktop, bridge, and multi-agent
execution are deferred.
10 changes: 10 additions & 0 deletions coding-agent/src/coding_agent/bee_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
load_bee_workspace_template,
write_bee_workspace_run_artifacts,
)
from coding_agent.observability import record_bee_launch_metric
from coding_agent.scheduled_runs import ScheduledLaunchIntent, ScheduleTriggerRecord
from coding_agent.topic_lifecycle import TopicLifecycle
from coding_agent.topic_store import JSONObject, JSONValue, TopicRecord
Expand Down Expand Up @@ -800,6 +801,15 @@ async def _launch(
launched_at=launch_started_at,
metadata={"phase": "task_created", "node_count": len(nodes)},
)
record_bee_launch_metric(
source=attached.source,
status=attached.status,
duration_ms=max(
0.0,
(launch_started_at - plan.requested_at).total_seconds() * 1000.0,
),
proactive_kind="unknown",
)
return BeeLaunchResult(
launch_id=attached.launch_id,
task_id=task_id,
Expand Down
Loading