mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-08 09:04:49 +08:00
observe_completion() on WorkerRegistry classifies finish_reason into
Finished vs Failed (finish='unknown' + 0 tokens = provider degraded).
This logic existed in the runtime but had no tool wrapper — clawhip
could not call it. Added WorkerObserveCompletion as a first-class tool.
Tool schema:
{ worker_id, finish_reason: string, tokens_output: integer }
Handler: run_worker_observe_completion -> global_worker_registry().observe_completion()
Tests added:
- worker_observe_completion_success_finish_sets_finished_status
finish=end_turn + tokens=512 -> status=finished
- worker_observe_completion_degraded_provider_sets_failed_status
finish=unknown + tokens=0 -> status=failed, last_error populated
89 tool tests passing, 0 failing.