molecule-core/workspace-server/internal/handlers
Molecule AI Infra-Runtime-BE 081b570525
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 20s
CI / Detect changes (pull_request) Successful in 44s
Harness Replays / detect-changes (pull_request) Successful in 16s
E2E API Smoke Test / detect-changes (pull_request) Successful in 32s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 14s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 32s
gate-check-v3 / gate-check (pull_request) Failing after 15s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 38s
qa-review / approved (pull_request) Failing after 14s
security-review / approved (pull_request) Failing after 15s
sop-checklist-gate / gate (pull_request) Successful in 15s
sop-tier-check / tier-check (pull_request) Successful in 16s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 36s
sop-checklist / all-items-acked (pull_request) [info tier:low] auto-success for tier:low
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m15s
CI / Canvas (Next.js) (pull_request) Successful in 11s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 7s
Harness Replays / Harness Replays (pull_request) Successful in 7s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 10s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 8s
audit-force-merge / audit (pull_request) Successful in 24s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 1m32s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m8s
CI / Platform (Go) (pull_request) Failing after 5m3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / all-required (pull_request) Successful in 7s
fix(delegations): ListDelegations falls back to delegations table before activity_logs
RFC #2829 PR-1/4: GET /workspaces/:id/delegations previously queried only
activity_logs, returning [] for active/completed delegations while the agent's
check_delegation_status showed them correctly. The new delegations table
(migration 049) now holds durable state for active delegations.

The handler now tries the ledger first (delegations table), falls back to
activity_logs for pre-migration data, and returns [] only when both are empty.
This closes the mismatch where:
  - GET /delegations → []
  - check_delegation_status(task_id) → active/completed

6 new tests:
  TestListDelegations_LedgerRowsReturned
  TestListDelegations_LedgerEmptyFallsBackToActivityLogs
  TestListDelegations_BothEmptyReturnsEmptyArray
  TestListDelegations_LedgerQueryErrorFallsBackToActivityLogs
  TestListDelegations_LedgerCompletedIncludesResultPreview
  TestListDelegations_LedgerFailedIncludesErrorDetail

Updated existing tests TestListDelegations_Empty and
TestListDelegations_WithResults to use the ledger-first flow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 21:50:03 +00:00
..
testdata
a2a_corpus_test.go
a2a_proxy_helpers_test.go fix: handle json null and empty array in extractToolTrace 2026-05-12 19:44:22 -07:00
a2a_proxy_helpers.go Merge origin/main into fix/stdio-fallback-all-environments 2026-05-13 11:44:23 +00:00
a2a_proxy_preflight_test.go test(handlers): drain preflight restart goroutine 2026-05-12 21:07:40 -07:00
a2a_proxy_test.go
a2a_proxy.go fix(a2a_proxy): return error for 2xx responses with empty body 2026-05-13 00:07:56 +00:00
a2a_queue_expiry_test.go test: add handler test coverage — workspace_crud, mcp_tools, org_layout, hub, a2a queue 2026-05-13 18:04:00 +00:00
a2a_queue_status_test.go
a2a_queue_status.go
a2a_queue_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
a2a_queue.go
activity_since_id_test.go
activity_since_secs_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
activity_test.go
activity.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
admin_delegations_test.go
admin_delegations.go
admin_memories_cutover_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
admin_memories_test.go
admin_memories.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
admin_plugin_drift_test.go
admin_plugin_drift.go
admin_queue_test.go
admin_queue.go
admin_schedules_health_test.go
admin_schedules_health.go
admin_test_token_test.go
admin_test_token.go
admin_workspace_images_test.go
admin_workspace_images.go
agent_git_identity_test.go
agent_git_identity.go
agent_message_persistence_gate_test.go
agent_message_writer_test.go
agent_message_writer.go
agent_test.go
agent.go
approvals_test.go
approvals.go
artifacts_test.go
artifacts.go
audit_test.go
audit.go
budget_test.go
budget.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
bundle_test.go fix(handlers): restore bundle import test build 2026-05-13 06:20:38 -07:00
bundle.go fix(handlers): restore bundle import test build 2026-05-13 06:20:38 -07:00
channels_test.go
channels.go
chat_files_poll_test.go
chat_files_test.go
chat_files.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
chat_history_test.go
chat_history.go
checkpoints_integration_test.go
checkpoints_test.go
checkpoints.go
class1_ast_gate_test.go
config_test.go
config.go
container_files_delete_test.go
container_files_test.go
container_files.go
delegation_executor_integration_test.go fix(ci): repair scheduled main janitors and track masks 2026-05-12 17:03:29 -07:00
delegation_inbox_push_test.go
delegation_ledger_integration_test.go fix(ci): repair scheduled main janitors and track masks 2026-05-12 17:03:29 -07:00
delegation_ledger_test.go fix(ci): repair scheduled main janitors and track masks 2026-05-12 17:03:29 -07:00
delegation_ledger_writes_test.go
delegation_ledger_writes.go
delegation_ledger.go fix(ci): repair scheduled main janitors and track masks 2026-05-12 17:03:29 -07:00
delegation_sweeper_test.go
delegation_sweeper.go
delegation_test.go fix(delegations): ListDelegations falls back to delegations table before activity_logs 2026-05-13 21:50:03 +00:00
delegation.go fix(delegations): ListDelegations falls back to delegations table before activity_logs 2026-05-13 21:50:03 +00:00
derive_provider_drift_test.go
discovery_test.go
discovery.go Merge origin/main into fix/stdio-fallback-all-environments 2026-05-13 11:44:23 +00:00
eic_tunnel_pool_setup.go
eic_tunnel_pool_test.go
eic_tunnel_pool.go
events_test.go
events.go
external_connection_test.go
external_connection.go feat(ui): Kimi bridge script now includes inbound polling + notify reply 2026-05-12 13:55:51 -07:00
external_rotate_test.go feat(ui): add Kimi CLI tab to external workspace connect modal 2026-05-12 13:41:33 -07:00
external_rotate.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
github_token_test.go
github_token.go
handlers_additional_test.go
handlers_extended_test.go
handlers_test.go
hermes_messages_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
hermes_messages.go
hibernation_test.go
instructions.go
local_e2e_dev_dept_test.go
mcp_test.go fix(test/mcp): align RecallMemory_GlobalScope with OFFSEC-001 scrub contract 2026-05-12 18:11:07 -07:00
mcp_tools_memory_legacy_shim_test.go
mcp_tools_memory_legacy_shim.go
mcp_tools_memory_v2_test.go
mcp_tools_memory_v2.go
mcp_tools_test.go test: add handler test coverage — workspace_crud, mcp_tools, org_layout, hub, a2a queue 2026-05-13 18:04:00 +00:00
mcp_tools.go
mcp.go
memories_test.go
memories_v2_test.go
memories_v2.go
memories.go
memory_test.go
memory.go
mock_runtime_test.go
mock_runtime.go
native_session_test.go
native_status_mgmt_test.go
org_external_integration_test.go
org_external_test.go
org_external.go
org_helpers_test.go
org_helpers.go
org_import_force_removed_test.go
org_import_helpers_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
org_import_idempotency_test.go
org_import_reconcile_test.go
org_import.go
org_include_symlink_test.go
org_include_test.go
org_include.go
org_path_test.go
org_persona_env_test.go fix(lint): resolve 64 pre-existing golangci-lint violations in workspace-server 2026-05-12 23:47:36 -07:00
org_plugin_allowlist_test.go
org_plugin_allowlist.go
org_prompt_ref_test.go
org_provision_concurrency_test.go
org_test.go
org_tokens_test.go
org_tokens.go
org_workspace_required_env_test.go
org.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
pending_uploads_integration_test.go
pending_uploads_test.go
pending_uploads.go
plugins_atomic_tar.go
plugins_atomic_test.go test: add handler test coverage — workspace_crud, mcp_tools, org_layout, hub, a2a queue 2026-05-13 18:04:00 +00:00
plugins_atomic.go
plugins_classifier_test.go
plugins_classifier.go
plugins_findrunning_ssot_test.go
plugins_install_eic_test.go
plugins_install_eic.go
plugins_install_external_test.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
plugins_install_pipeline_test.go
plugins_install_pipeline.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
plugins_install.go
plugins_listing.go
plugins_sources.go
plugins_test.go
plugins_tracking_test.go
plugins_tracking.go
plugins.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
provlog_emit_test.go
registry_test.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
registry.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
restart_context_test.go
restart_context.go
restart_signals_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
restart_signals.go
restart_template_test.go
restart_template.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
runtime_image_pin_test.go
runtime_image_pin.go
runtime_overrides_test.go
runtime_overrides.go
runtime_provision_timeouts_test.go
runtime_provision_timeouts.go
runtime_registry_test.go feat(kimi): Kimi as first-class BYO-compute runtime + delegation retry fix 2026-05-13 09:01:30 -07:00
runtime_registry.go feat(kimi): Kimi as first-class BYO-compute runtime + delegation retry fix 2026-05-13 09:01:30 -07:00
saas_default_tier_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
sanitize_filename_test.go
schedules_test.go
schedules.go
secrets_test.go
secrets.go
security_regression_685_686_687_688_test.go
socket_test.go fix(test/handlers): correct newSocketHandlerWithDB signature — drop *sql.DB param 2026-05-12 18:40:42 -07:00
socket.go
sse_test.go
sse.go
ssrf_test.go
ssrf.go
template_files_eic_dispatch_test.go
template_files_eic_shells_test.go
template_files_eic_test.go
template_files_eic.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
template_import_test.go
template_import.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
templates_test.go
templates.go fix(lint): resolve 64 pre-existing golangci-lint violations in workspace-server 2026-05-12 23:47:36 -07:00
terminal_diagnose_test.go
terminal_diagnose.go fix(handlers/terminal): fix unwrapGoError separator — use LastIndex("(") not ") " 2026-05-12 19:27:32 +00:00
terminal_test.go
terminal.go
tokens_sqlmock_test.go
tokens_test.go
tokens.go
traces_test.go
traces.go
transcript_test.go
transcript.go
viewport_test.go
viewport.go
webhooks_test.go
webhooks_workflow_test.go
webhooks.go
workspace_bootstrap_test.go
workspace_bootstrap.go
workspace_budget_test.go
workspace_create_name_integration_test.go
workspace_create_name_test.go
workspace_create_name.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
workspace_crud_test.go fix(ci): repair handler test compile drift 2026-05-13 20:31:27 +00:00
workspace_crud.go fix(lint): resolve 64 pre-existing golangci-lint violations in workspace-server 2026-05-12 23:47:36 -07:00
workspace_dispatchers.go
workspace_metrics_test.go
workspace_metrics.go
workspace_namespace_cleanup_test.go
workspace_preflight_test.go
workspace_preflight.go
workspace_provision_auto_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
workspace_provision_concurrent_repro_test.go
workspace_provision_panic_test.go
workspace_provision_shared_test.go
workspace_provision_shared.go
workspace_provision_test.go fix(platform): clear golangci-lint findings 2026-05-12 22:53:22 -07:00
workspace_provision.go
workspace_restart_async_test.go
workspace_restart_coalesce_test.go
workspace_restart_stop_retry_test.go
workspace_restart_test.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
workspace_restart.go fix(runtime): accept kimi as external workspace runtime 2026-05-12 13:28:13 -07:00
workspace_test.go feat(kimi): Kimi as first-class BYO-compute runtime + delegation retry fix 2026-05-13 09:01:30 -07:00
workspace.go feat(kimi): Kimi as first-class BYO-compute runtime + delegation retry fix 2026-05-13 09:01:30 -07:00
workspaces_insert_allowlist_test.go