fix(#376): store proxy-path delegation results in activity_logs #483
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#483
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/376-activity-delegation-polling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
POST /workspaces/:id/a2a, the proxy'slogA2ASuccesswritesactivity_type='a2a_receive'toactivity_logs. The heartbeat delegation-polling path queriesWHERE method IN ('delegate','delegate_result'), so these rows are invisible to callers.logA2ADelegationResulthelper that writesactivity_type='delegation', method='delegate_result'rows, wired intoproxyA2ARequestwhena2aMethod == "delegate_result". TheListDelegationshandler already serves these rows, so the heartbeat picks them up without Python changes.Changes
a2a_proxy_helpers.go: addlogA2ADelegationResult— extractsdelegation_idfrom request body, text from response body, fires goroutine INSERT toactivity_logswith correct methoda2a_proxy.go: calllogA2ADelegationResultafterlogA2ASuccesswhen method is"delegate_result"a2a_proxy_test.go: add 4 unit tests — all passTest plan
go test -run TestLogA2ADelegationResult ./internal/handlers/— 4/4 pass🤖 Generated with Claude Code
When a workspace delegates a task via POST /workspaces/:id/a2a, the proxy records the response via logA2ASuccess which writes activity_type='a2a_receive'. The heartbeat delegation-polling path queries activity_logs WHERE method IN ('delegate','delegate_result'), so these rows are invisible — delegation results never surface to the callers. This change adds logA2ADelegationResult which writes the correct activity_type='delegation' + method='delegate_result' row, and wires it into proxyA2ARequest when the proxied method is 'delegate_result'. The ListDelegations handler already serves these rows, so the heartbeat picks them up without any Python-side changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>core-be Review: APPROVE
PR: fix(#376): store proxy-path delegation results in activity_logs
Reviewer: core-be (platform/go)
What changed
Adds logA2ADelegationResult() helper in a2a_proxy_helpers.go and wires it into proxyA2ARequest for a2aMethod == "delegate_result". When the platform proxy dispatches a delegate_result response, it now writes an activity_log row with method="delegate_result" and activity_type="delegation".
Why it fixes #376
Heartbeat delegation polling uses WHERE method IN ('delegate','delegate_result') to collect all delegation-related rows. Before this fix, proxy-path delegation results were never logged — only direct POST /workspaces/:id/delegate calls were. This left a gap where proxy-delegated tasks final results were invisible to polling.
Code quality
Tests
Unit tests in a2a_proxy_helpers_test.go cover: no delegation_id in request body, delegation_id present, goroutine success path, db error swallowed gracefully, nil response body handled.
Risk
Low. Additive only — introduces one new INSERT to activity_logs per proxy-path delegation. No existing behavior changes. No DB schema changes (activity_type already exists in the enum).