Skip to content
Merged
1 change: 1 addition & 0 deletions changelog.d/changed-knowledge-adviser-async.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **knowledge advisor:** the runtime now calls the knowledge adviser off the agent's poll goroutine with at most one call in flight per agent, so a slow adviser no longer stalls the tick; results are held until the delivery gates pass and dropped if the kick changed. Each observed scope carries an `Action` (`read`/`edit`/`run`) and is re-advised at most once, on its first edit or next `gh` command. An adviser can request a token-scrubbed pane tail, which the built-in matcher never does (#17153).
8 changes: 5 additions & 3 deletions src/cmd/hive/knowledge_adviser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
// not already carry.

const (
// knowledgeAdviseTimeout bounds one adviser query. It runs on the agent's
// poll goroutine, so a slow wiki layer must not stall the poller.
// knowledgeAdviseTimeout bounds one adviser query. The runtime calls it off
// the poll goroutine, one call per agent at a time, so a slow wiki layer
// only holds back that agent's next scope.
knowledgeAdviseTimeout = 5 * time.Second
// knowledgeAdviseMaxPerScope caps how many entries one scope may queue;
// the runtime's per-kick cap is the real bound, this keeps the queue short.
Expand Down Expand Up @@ -61,7 +62,8 @@ func (a *knowledgeAdviser) Policy(agent string) crux.KnowledgeAdvisorPolicy {
if cfg == nil || !cfg.KnowledgeAdvisorEnabledFor(agent) {
return crux.KnowledgeAdvisorPolicy{}
}
return crux.KnowledgeAdvisorPolicy{Enabled: true, MaxPerKick: cfg.Knowledge.AdvisorMaxPerKick}
// The matcher works from the scope alone; it never asks for pane text.
return crux.KnowledgeAdvisorPolicy{Enabled: true, MaxPerKick: cfg.Knowledge.AdvisorMaxPerKick, WantsPaneTail: false}
}

// Advise searches the knowledge store for scope. Until #17045 lands the
Expand Down
Loading
Loading