mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 21:50:42 +00:00
[codex] Fix commitments safety and coverage (#75302)
* fix commitments safety and coverage * Repair commitments safety PR review blockers * fix(clawsweeper): address review for automerge-openclaw-openclaw-75302 (1) * Repair commitments safety PR review blocker --------- Co-authored-by: clawsweeper-repair <clawsweeper-repair@users.noreply.github.com>
This commit is contained in:
@@ -46,6 +46,7 @@ let runtime: CommitmentExtractionRuntime = {};
|
||||
let queue: Array<Omit<CommitmentExtractionItem, "existingPending"> & { cfg?: OpenClawConfig }> = [];
|
||||
let timer: TimerHandle | null = null;
|
||||
let draining = false;
|
||||
let queueOverflowWarned = false;
|
||||
|
||||
function shouldDisableBackgroundExtractionForTests(): boolean {
|
||||
if (runtime.forceInTests) {
|
||||
@@ -80,6 +81,7 @@ export function resetCommitmentExtractionRuntimeForTests(): void {
|
||||
queue = [];
|
||||
timer = null;
|
||||
draining = false;
|
||||
queueOverflowWarned = false;
|
||||
}
|
||||
|
||||
function buildItemId(params: CommitmentExtractionEnqueueInput, nowMs: number): string {
|
||||
@@ -104,6 +106,16 @@ export function enqueueCommitmentExtraction(input: CommitmentExtractionEnqueueIn
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (queue.length >= resolved.extraction.queueMaxItems) {
|
||||
if (!queueOverflowWarned) {
|
||||
log.warn("commitment extraction queue full; dropping hidden extraction request", {
|
||||
queued: queue.length,
|
||||
max: resolved.extraction.queueMaxItems,
|
||||
});
|
||||
queueOverflowWarned = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const nowMs = input.nowMs ?? Date.now();
|
||||
queue.push({
|
||||
itemId: buildItemId(input, nowMs),
|
||||
|
||||
Reference in New Issue
Block a user