Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"format": "biome format --write src tests"
},
"dependencies": {
"@tangle-network/agent-eval": ">=0.77.0 <0.80.0",
"@tangle-network/agent-runtime": "^0.44.0",
"@tangle-network/agent-eval": "^0.91.0",
"@tangle-network/agent-runtime": "^0.50.0",
"zod": "^4.3.6"
},
"devDependencies": {
Expand Down
29 changes: 16 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions src/profiles/researcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
import {
type AgentProfile,
type AgentRunSpec,
createFanoutVoteDriver,
createDriver,
type DefaultVerdict,
type Driver,
type DriverDecision,
type OutputAdapter,
type SandboxEvent,
type Validator,
Expand Down Expand Up @@ -185,7 +186,7 @@ export function multiHarnessResearcherFanout(options: MultiHarnessResearcherFano
agentRuns: AgentRunSpec<ResearchTask>[]
output: OutputAdapter<ResearchOutput>
validator: Validator<ResearchOutput>
driver: Driver<ResearchTask, ResearchOutput, 'pick-winner' | 'fail'>
driver: Driver<ResearchTask, ResearchOutput, DriverDecision>
} {
const harnesses =
options.harnesses && options.harnesses.length > 0
Expand All @@ -200,7 +201,15 @@ export function multiHarnessResearcherFanout(options: MultiHarnessResearcherFano
citationDensityMin: options.citationDensityMin,
task: options.task,
})
const driver = createFanoutVoteDriver<ResearchTask, ResearchOutput>({ n: harnesses.length })
// Single fanout round across the N harnesses, then stop: the kernel
// round-robins `agentRuns` over the N branches and selects the winner
// (best valid score) across all iterations via `defaultSelectWinner`.
const driver = createDriver<ResearchTask, ResearchOutput>({
planner: ({ task, history }) =>
history.length === 0
? { kind: 'fanout', tasks: Array.from({ length: harnesses.length }, () => task) }
: { kind: 'stop' },
})
return { agentRuns, output, validator, driver }
}

Expand Down
12 changes: 6 additions & 6 deletions tests/loops/researcher-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('researcherProfile end-to-end through runLoop', () => {
ctx: { sandboxClient: client },
})

expect(result.decision).toBe('pick-winner')
expect(result.decision).toBe('done')
expect(result.iterations).toHaveLength(3)
expect(result.winner).toBeDefined()
expect(result.winner?.output.items).toHaveLength(1)
Expand All @@ -135,15 +135,15 @@ describe('researcherProfile end-to-end through runLoop', () => {
ctx: { sandboxClient: client },
})

expect(result.decision).toBe('fail')
expect(result.decision).toBe('done')
expect(result.iterations).toHaveLength(2)
for (const iter of result.iterations) {
expect(iter.verdict?.valid).toBe(false)
expect(iter.verdict?.notes).toMatch(/namespace violation/)
}
// The kernel surfaces a structural top-of-attempts even on `fail`.
// The contract is `decision === 'fail'` + `winner.verdict.valid === false`;
// never a winner with `valid === true` when every output leaked.
// The kernel may surface a structural top-of-attempts even when nothing
// validates. The contract is: never a winner with `valid === true` when
// every output leaked across namespaces.
if (result.winner) {
expect(result.winner.verdict?.valid).toBe(false)
}
Expand All @@ -168,7 +168,7 @@ describe('researcherProfile end-to-end through runLoop', () => {
ctx: { sandboxClient: client },
})

expect(result.decision).toBe('pick-winner')
expect(result.decision).toBe('done')
expect(result.winner?.iterationIndex).toBe(1)
expect(result.winner?.agentRunName).toBe('researcher-high-quality')
})
Expand Down
4 changes: 2 additions & 2 deletions tests/profiles/researcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ describe('loose-output passthrough', () => {
})

describe('multiHarnessResearcherFanout', () => {
it('builds N AgentRunSpecs with a FanoutVote driver', () => {
it('builds N AgentRunSpecs with a single-fanout-then-stop driver', () => {
const fan = multiHarnessResearcherFanout({
harnesses: ['claude-code', 'codex', 'opencode/zai-coding-plan/glm-5.1'],
})
Expand All @@ -414,7 +414,7 @@ describe('multiHarnessResearcherFanout', () => {
])
expect(typeof fan.driver.plan).toBe('function')
expect(typeof fan.driver.decide).toBe('function')
expect(fan.driver.name).toBe('fanout-vote')
expect(fan.driver.name).toBe('dynamic')
})

it('falls back to three default harnesses when none supplied', () => {
Expand Down
Loading