mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 09:32:45 +01:00
On Docker fault set D6, an investigation's first `pulse_read disk_usage` call on the finding's own mount named no host. It was refused with `target_host is required`. The model then looked the host up with `pulse_query get` and retried, which cost one of its ten evidence calls. What changes: - A Patrol investigation attaches the resource of the finding it investigates as its current resource (`PulseToolExecutor.AttachResource`). It is registered the same way a `pulse_query get` registers one, and `current_resource` resolves to it. - Core reads the resource ID from its own findings store (`orchestratorChatAdapter.findingResourceID`), never from the model or the orchestrator's payload. Enterprise is unchanged. - An agent-routed read (`exec`, `file`, `find`, `tail`, `disk_usage`) that names neither `target_host` nor `resource_id` runs on the attached resource when exactly one resolves (`readTargetHost`). With none or several it is refused as before. A read naming a host or another resource is untouched. `logs` is left alone because its `resource_id` means a native log source. Tests: `TestReadThatNamesNoHostRunsOnTheAttachedResource` (tools) and `TestInvestigationAttachesItsFindingsResource` (chat). The second covers a finding type that is wrong while the canonical ID is right, and a run with no finding resource. The `internal/ai/tools` package and the chat and `internal/api` investigation tests pass. `internal/api/ai_handlers.go` is contract-neutral for agent-lifecycle, api-contracts and storage-recovery (trailer in the commit). The behavior is recorded in `ai-runtime`. Not replayed. The change removes one refusal from the first read, and the D6 qwen3:8b run that hit it was already Handed over.