feat(backend): push manager_worker coop-group events and structure ClawMind execution_graph - #1575
Open
jiangj0627 wants to merge 4 commits into
Open
feat(backend): push manager_worker coop-group events and structure ClawMind execution_graph#1575jiangj0627 wants to merge 4 commits into
jiangj0627 wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
execution_graphwas a raw passthrough ofext_info({flow_runs, node_executions}), not a structuredTaskExecutionGraph. The DAG encoded in each node'sinput_json.nodeOutputKeyswas never turned into relations/edges, so the dashboard received the raw envelope, and the bogussucceeded_countwas surfaced verbatim.manager_workercollaboration groups had no event stream: the group was created without subscribing, so §4 events were never pushed back,apply_manager_worker_eventwas dormant, the dashboard hadno audit snapshot, and terminal convergence relied solely on the result poller (the state after commit
fa6c1f067removed inline subscriptions). The manager_worker group event stream is now required.has_yaml(state_machine/manager_worker); there was no way to explicitly selectchat/manager_worker.Solution
Across two commits:
1.
fe0f2bbffexecution_graph→graph_to_dict-shapedTaskExecutionGraph: new_build_claw_mind_execution_graphconvertsflow_runs/node_executionsinto{run_id, task_id, loop_round, status, output, extend_props, tasks[], relations[]}.relationsare derived from each node'sinput_json.nodeOutputKeys(multi-parent DAG, dangling edges filtered out); the low-level status is mapped tothe 7-state
Statusenum; rich fields (token_usage/timing/executor_type/input) are folded intorun_info.extend_props. Secrets/digests/version (credentials_json/identity_key/plugin_version) areexcluded, and the bogus graph-level
succeeded_countis dropped (nodes are the authoritative source). The adapter does not import repository serializers — it hand-writes the same dict shape(comment-marked to keep in sync) and only reuses the domain
Statusenum.ZdasBcsBotTokenProvider: readsbcs_bots.session_tokendirectly via the prodDatabasePlugin(ZDASagentclawdb_ds, same DB asbcs_bots), wrapped inCachingBcsBotTokenProvider(TTL), andwired as the default in
task_module. This supplies thecaller_bot_token(Authorization: Bearer) driver-bot caller identity forcreate_group. Locally there is nobcs_botstable → the queryerror is swallowed →
None(no Bearer sent; local BCS ignores auth, harmless).execution_graph == ext_infointest_callback_adapter/test_task_callback_reportto the structured-shape assertion.2.
3831eb7b7execution_config.group_kind(additive, non-breaking):_run_yamlderivescollab_modeas: yaml body present →state_machine(group_kindnot consulted, existing logic unchanged); no yaml →group_kind=chat(new exit),None/manager_worker→manager_worker(unchanged),state_machinewithout yaml / unknown value →ValueError.manager_workergroups now always inline-attach a §4event_subscriptions(in themanager_workerbranch ofform_coop_group):event_filters = group.created/session.created/task.assigned/task.completed/session.completed,payload.mode = full,sink.url = {api_base_url}/api/v1/collaboration/tasks/callback/report. BCS pushes these back,activating the existing
apply_manager_worker_event→task_callback.execution_graphaudit snapshot +converge_by_sessionterminal convergence.state_machine/chatdo not attach (the existingnegative test
test_form_coop_group_does_not_attach_event_subscriptionsis untouched and still passes). Auth stays HMAC + existingcaller_bot_token(Bearer), no cookie; if_api_base_urlis unset,subscriptions are skipped with a warning and the poller remains the convergence fallback.
Validation
group_kindcases;manager_workersubscriptions (attached / skipped withoutapi_base_url/ not attached forchat); end-to-endexecute → engine → form_coop_group → create_groupattaching the §4 subscription; existingstate_machinenegative test still green.Compatibility and risk
execution_graphshape change: from raw{flow_runs, node_executions}to a structuredTaskExecutionGraphdict. The only consumer today is the dashboard passthrough(
graph.execution_graph = rec.execution_graph) with no hard parser downstream, so there is no breaking consumer.manager_workergroup creation now attaches a subscription + triggersrequire_human: the auth assumption is thatBearer(+HMAC) satisfiesrequire_humanwithout a cookie. This contradictsthe older memory
bcs-create-group-auth-modelfinding (Bearer→403). Live BCS validation is required; if rejected, the fallback is to add a cookie path formanager_worker(deliberately not donehere).
sink.url: if_api_base_urlis unset, subscriptions are skipped (poller convergence fallback, no audit snapshot).group_kindis non-breaking: existinghas_yaml → state_machine/manager_workercallers are unaffected; it only adds achatexit and explicit selection when no yaml is present.manager_workergroups (both thegroup_kindexplicit path and dynamic dispatch), decided bymodeinform_coop_group;chat/state_machinedo not attach.Related
zeodup/vh3397/yt7ekehen7dpuyeq(§1 create-group subscriptions, §4 manager_worker events).manager_workerthis effectively rolls back commitfa6c1f067's "remove inline subscriptions";state_machine/chatare unchanged.