Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): accept in-flight benchmark runs across scorer upgrades
[._.]/ Adam Eivy85ab1e656d47
diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.jsindex de2637699b..f3d8464f01 100644--- a/server/services/meatspacePost.js+++ b/server/services/meatspacePost.js@@ -116,6 +116,21 @@ export const POST_BENCHMARK_PROTOCOL = Object.freeze({]),});+// Scorer versions retired by a scoring-contract change (e.g. v1 → v2's fixed+// weights/timeLimit) but still ACCEPTABLE on submit — never rejected/lost —+// so an in-flight benchmark run started under the old formula (client+// fetched the old protocol before a server upgrade landed mid-session) can+// still be saved after the upgrade (issue #4442 codex review; mirrors the+// PROMPT_VERSIONS/PREVIOUS_DEFAULT_PROMPTS cross-version pattern in+// taskSchedule.js). Task/config shape is unchanged across scorer versions —+// only the scoring formula moved — so accepting it costs nothing: the+// submission is scored under the CURRENT rules regardless (submitPostSession+// only branches on `sessionData.benchmark` truthiness, not on which scorer+// version it names), and its stored scorerVersion is preserved as submitted,+// so benchmarkCompatibility() still correctly excludes it from the current+// trend as legacy rather than silently blending two formulas together.+const PREVIOUS_BENCHMARK_SCORER_VERSIONS = Object.freeze(['post-deterministic-v1']);+const cloneBenchmarkProtocol = (protocol) => JSON.parse(JSON.stringify(protocol));export function getPostBenchmarkForm(formId) {@@ -151,9 +166,15 @@ export function benchmarkCompatibility(session) {function assertBenchmarkSession(benchmark, tasks, modules) {if (!benchmark) return;+ // Accept the current scorer version OR a recognized-but-retired one — see+ // PREVIOUS_BENCHMARK_SCORER_VERSIONS. Rejecting an in-flight run just+ // because the server's scorer version moved on mid-session would lose the+ // user's completed work; the form/task shape hasn't changed, only scoring.+ const versionRecognized = benchmark.scorerVersion === POST_BENCHMARK_PROTOCOL.scorerVersion+ || PREVIOUS_BENCHMARK_SCORER_VERSIONS.includes(benchmark.scorerVersion);const form = benchmark.protocolId === POST_BENCHMARK_PROTOCOL.protocolId&& benchmark.protocolVersion === POST_BENCHMARK_PROTOCOL.protocolVersion- && benchmark.scorerVersion === POST_BENCHMARK_PROTOCOL.scorerVersion+ && versionRecognized? getPostBenchmarkForm(benchmark.formId): null;const expectedModules = form ? [...new Set(form.tasks.map((task) => task.domain))] : [];diff --git a/server/services/meatspacePost.test.js b/server/services/meatspacePost.test.jsindex d98d322b24..a36b8faef5 100644--- a/server/services/meatspacePost.test.js+++ b/server/services/meatspacePost.test.js@@ -58,6 +58,7 @@ import {getPostReviewReps,getPostBenchmarkProtocol,POST_BENCHMARK_PROTOCOL,+ benchmarkCompatibility,} from './meatspacePost.js';import { generateCognitiveDrill } from './meatspacePostCognitive.js';@@ -227,6 +228,26 @@ describe('submitPostSession — benchmark scoring is fixed by the protocol', ()// Confirms the fixed-time-limit behavior above is benchmark-specific.expect(mathTask.score).toBe(82);});++ it('accepts an in-flight run tagged with a RETIRED scorer version instead of losing it (issue #4442 codex review round 3)', async () => {+ readJSONFile.mockImplementation((path, defaultValue) => Promise.resolve(defaultValue));+ const submission = benchmarkSubmission();+ submission.benchmark.scorerVersion = 'post-deterministic-v1'; // client fetched the protocol before the server upgraded+ const session = await submitPostSession(submission);+ // Not rejected, still scored under the CURRENT (fixed-weights) rules.+ expect(session.score).toBe(50);+ // The retired tag is preserved as submitted, not silently upgraded —+ // benchmarkCompatibility() still correctly excludes it from the v2 trend.+ expect(session.benchmark.scorerVersion).toBe('post-deterministic-v1');+ expect(benchmarkCompatibility(session)).toBe('legacy');+ });++ it('still rejects a benchmark submission tagged with an unrecognized scorer version', async () => {+ readJSONFile.mockImplementation((path, defaultValue) => Promise.resolve(defaultValue));+ const submission = benchmarkSubmission();+ submission.benchmark.scorerVersion = 'some-made-up-version';+ await expect(submitPostSession(submission)).rejects.toMatchObject({ code: 'INVALID_BENCHMARK', status: 400 });+ });});// Structured session conditions (issue #4442) — sleepQuality/caffeine/stress