MCPcopy Index your code
hub / github.com/codehamr/codehamr / dispatchNextTool

Method dispatchNextTool

internal/tui/model.go:1053–1061  ·  view source on GitHub ↗

dispatchNextTool pops the next pending tool call and runs it. Every tool flows through runToolCall; none are special-cased. lastToolKey records this call's target so the failure nudge can tell when the model keeps retrying the same failing operation (see recordToolOutcome).

()

Source from the content-addressed store, hash-verified

1051 m.pending = m.pending[1:]
1052 m.appendLine(styleDim.Render(tools.InlineStatus(call)))
1053 m.lastToolKey = toolTargetKey(call)
1054 m.toolRounds++
1055 m.phase = phaseRunning
1056 return m, runToolCall(m.turnCtx, call)
1057}
1058
1059// nudgeOrigin prefixes every deterministic backstop note. A weak (30B) model
1060// reads a bare mid-turn system message as an empty/absent user turn ("the user
1061// hasn't given me a new task, I'll just stop"), the exact misread that turned the
1062// finish nudge net-negative on the galaxy run (it re-prompted an honest
1063// `unverified` finish into a confident, caveat-free "it works"). Naming the note
1064// as codehamr's own automated check, not the user's, keeps the model oriented.

Callers 2

updateMethod · 0.95
handleStreamClosedMethod · 0.95

Calls 4

appendLineMethod · 0.95
InlineStatusFunction · 0.92
toolTargetKeyFunction · 0.85
runToolCallFunction · 0.85

Tested by

no test coverage detected