GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Backstop refusal log: a set when ids are never forgotten; note on reg… · scuttletoby/t3code@27b1a8a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/fork/delegatedResults
    • DelegatedOrphanScan.ts
    • delegatedResults.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/fork/delegatedResults/DelegatedOrphanScan.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/fork/delegatedResults/DelegatedOrphanScan.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export const make = Effect.fn("DelegatedOrphanScan.make")(function* (
121121
const waitingForSlot = new Map<ThreadId, ParentOutcome>();
122122
// Never forgotten: an orphan batch's ids do not age, and a slot wait checks its parent again for
123123
// as long as the slot stays taken, a day or more. One run per start, so this holds at most the
124-
// refused batches of that run.
124+
// refused batches of that run. A regrouped batch (new keys after a relist, or after a send) has
125+
// a new command id: it counts as a new batch, so it is logged once more.
125126
const newRefusal = makeRefusalLog(null);
126127
const settings = yield* ServerSettingsService;
127128
const store = yield* DelegatedResultsStore.DelegatedResultsStore;
Collapse file

‎apps/server/src/fork/delegatedResults/delegatedResults.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/fork/delegatedResults/delegatedResults.ts
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,23 @@ export const isRemindable = (task: OrchestrationV2Subagent, nowMs: number): bool
117117
* (the reminder's tasks ended before the refusal, so none is reminded a day later); `null` keeps
118118
* every id for the process.
119119
*/
120-
export const makeRefusalLog = (forgetAfterMs: number | null = REMINDER_MAX_AGE_MS) => {
120+
export const makeRefusalLog = (
121+
forgetAfterMs: number | null = REMINDER_MAX_AGE_MS,
122+
): ((commandId: string, nowMs: number) => boolean) => {
123+
if (forgetAfterMs === null) {
124+
// Nothing is forgotten, so no time is kept.
125+
const logged = new Set<string>();
126+
return (commandId) => {
127+
if (logged.has(commandId)) return false;
128+
logged.add(commandId);
129+
return true;
130+
};
131+
}
132+
// When each id was logged: the prune reads it.
121133
const logged = new Map<string, number>();
122-
return (commandId: string, nowMs: number): boolean => {
123-
if (forgetAfterMs !== null) {
124-
for (const [id, atMs] of logged) {
125-
if (nowMs - atMs > forgetAfterMs) logged.delete(id);
126-
}
134+
return (commandId, nowMs) => {
135+
for (const [id, atMs] of logged) {
136+
if (nowMs - atMs > forgetAfterMs) logged.delete(id);
127137
}
128138
if (logged.has(commandId)) return false;
129139
logged.set(commandId, nowMs);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.