惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
U
Unit 42
M
MIT News - Artificial intelligence
小众软件
小众软件
P
Proofpoint News Feed
雷峰网
雷峰网
L
LangChain Blog
S
SegmentFault 最新的问题
腾讯CDC
F
Fortinet All Blogs
A
About on SuperTechFans
WordPress大学
WordPress大学
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
Recent Announcements
Recent Announcements
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(agents): prioritize manual session turns (#82765) · o...
galiniliev · 2026-05-17 · via Recent Commits to openclaw:main

@@ -61,6 +61,8 @@ type QueueEntry = {

6161

resolve: (value: unknown) => void;

6262

reject: (reason?: unknown) => void;

6363

enqueuedAt: number;

64+

sequence: number;

65+

priority: number;

6466

warnAfterMs: number;

6567

taskTimeoutMs?: number;

6668

taskTimeoutProgressAtMs?: () => number | undefined;

@@ -107,6 +109,7 @@ function getQueueState() {

107109

lanes: new Map<string, LaneState>(),

108110

activeTaskWaiters: new Set<ActiveTaskWaiter>(),

109111

nextTaskId: 1,

112+

nextQueueSequence: 1,

110113

}));

111114

// Schema migration: the singleton may have been created by an older code

112115

// version (e.g. v2026.4.2) that did not include `activeTaskWaiters`. After

@@ -117,6 +120,27 @@ function getQueueState() {

117120

if (!state.activeTaskWaiters) {

118121

state.activeTaskWaiters = new Set<ActiveTaskWaiter>();

119122

}

123+

if (!state.nextQueueSequence) {

124+

state.nextQueueSequence = 1;

125+

}

126+

let maxQueueSequence = state.nextQueueSequence - 1;

127+

for (const lane of state.lanes.values()) {

128+

for (const entry of lane.queue as Array<

129+

QueueEntry & { priority?: number; sequence?: number }

130+

>) {

131+

if (typeof entry.priority !== "number") {

132+

entry.priority = 0;

133+

}

134+

if (typeof entry.sequence !== "number") {

135+

entry.sequence = state.nextQueueSequence++;

136+

} else {

137+

maxQueueSequence = Math.max(maxQueueSequence, entry.sequence);

138+

}

139+

}

140+

}

141+

if (state.nextQueueSequence <= maxQueueSequence) {

142+

state.nextQueueSequence = maxQueueSequence + 1;

143+

}

120144

return state;

121145

}

122146

@@ -204,6 +228,30 @@ function normalizeTaskTimeoutMs(value: number | undefined): number | undefined {

204228

return Math.max(1, Math.floor(value));

205229

}

206230231+

function resolveQueuePriority(priority: CommandQueueEnqueueOptions["priority"]): number {

232+

switch (priority) {

233+

case "foreground":

234+

return 1;

235+

case "background":

236+

return -1;

237+

default:

238+

return 0;

239+

}

240+

}

241+242+

function enqueueLaneEntry(state: LaneState, entry: QueueEntry): void {

243+

const insertAt = state.queue.findIndex(

244+

(queued) =>

245+

queued.priority < entry.priority ||

246+

(queued.priority === entry.priority && queued.sequence > entry.sequence),

247+

);

248+

if (insertAt < 0) {

249+

state.queue.push(entry);

250+

return;

251+

}

252+

state.queue.splice(insertAt, 0, entry);

253+

}

254+207255

async function runQueueEntryTask(lane: string, entry: QueueEntry): Promise<unknown> {

208256

const taskPromise = Promise.resolve().then(entry.task);

209257

const taskTimeoutMs = normalizeTaskTimeoutMs(entry.taskTimeoutMs);

@@ -362,11 +410,13 @@ export function enqueueCommandInLane<T>(

362410

const warnAfterMs = opts?.warnAfterMs ?? 2_000;

363411

const state = getLaneState(cleaned);

364412

return new Promise<T>((resolve, reject) => {

365-

state.queue.push({

413+

enqueueLaneEntry(state, {

366414

task: () => task(),

367415

resolve: (value) => resolve(value as T),

368416

reject,

369417

enqueuedAt: Date.now(),

418+

sequence: queueState.nextQueueSequence++,

419+

priority: resolveQueuePriority(opts?.priority),

370420

warnAfterMs,

371421

taskTimeoutMs: normalizeTaskTimeoutMs(opts?.taskTimeoutMs),

372422

taskTimeoutProgressAtMs: opts?.taskTimeoutProgressAtMs,

@@ -472,6 +522,7 @@ export function resetCommandQueueStateForTest(): void {

472522

resolveActiveTaskWaiter(waiter, { drained: true });

473523

}

474524

queueState.nextTaskId = 1;

525+

queueState.nextQueueSequence = 1;

475526

}

476527477528

/**