Skip to content

fix(platform): stage re-delivered outputs by last write - #4452

Merged
yannickmonney merged 1 commit into
mainfrom
fix/output-last-write-staging
Oct 7, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/output-last-write-staging

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

With 65 retained outputs, re-delivering the first file previously left it outside the last-64 staging window. Trusted output replacement now removes the old entry and appends the new one, so staging selects by last write while preserving the latest file metadata and producing run.

Repairs #4448 and its post-merge finding, comment 6020865631. Task: TALE-1014; implementation owner C12 (31b27429-fe64-4694-86de-4169cb2067f3). Branched from current main 1e1b89d0479945ef17d3cd991e511ec2dd548d9a.

Validation: the replacement regression failed before the fix; 48 tests across output writer, staging selection, run completion and review-file suites passed after it with one Node worker. Explicit 64/65 default-cap cases are included. Scoped oxlint, oxfmt and diff check passed; commit ran normal formatting/conflict/SAST and commitlint hooks. The standard local Vitest config could not collect because the shared dependency tree lacks the current UI export; the retained targeted config uses the same server setup and YAML plugin with current-source workspace aliases. No dependencies installed. Full typecheck/integration/build were not run locally; CI remains the oracle.

Follow-up: omitted-output notices need a supported retrieval request route for ordinary working agents. Today omitted inputs require authorized restaging/reattachment; reviewer-only reviewFiles is not a general retrieval capability. This patch does not invent an unavailable route. Previously retained entries are not retroactively sorted; subsequent writes establish recency without a schema migration.

Independent exact-head review is requested through Fleet coordination; this is implementation evidence, not independent acceptance. Publication released by Fleet #1; one push/PR, CI read once without reruns.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

ACCEPT — independent review at 61979ccfed55d9dbfffc27a396655f5bf6c94402 (TALE-1017).

  • DATA: PASS. Same normalized name removes its old entry and appends the complete new metadata and producing run; unrelated entries retain relative order and the input array is copied. Repeated identical delivery introduces no duplicate and converges to the same contents/order when repeated consecutively; a later delivery after other writes intentionally refreshes recency. Both production callers were inspected: completeAgentRunInTx runs through transactSerializable, queues on the task and locks run/task rows; terminal-run replays return false before writing. The legacy trusted shim also uses transactSerializable. Conflicting writes therefore retry the entire read/merge/write rather than silently losing another committed output; exhausted retries fail visibly. Recency means successful write ordering, not originating-run start time. Legacy retained history is not retrospectively sorted.
  • CODE / REL-MANUAL: PASS by source reasoning. With old next[at] = entry, the 65-output regression leaves report-0 at index 0, fails the persisted-order assertion, and slice(-64) omits it. With splice/push, persisted order is reports 1–64 then replacement; selected order is reports 2–64 then replacement, omitted=1, with run-new/latest metadata preserved and original inputs unchanged. The existing two-entry replacement assertion also fails before/pass after. The added 64/65 selector cases independently prove the cap boundary; they already pass before this writer fix. All production callers and the selection caller in stageTaskInputs were inspected. Local test execution: NOT_RUN (optional; source proof chosen, no test phase started). CI is the execution oracle, not a claim of a fresh local test run.
  • PERFORMANCE / RESOURCES: PASS by complexity analysis. Existing copy/find/JSON rewrite is linear in retained history; splice adds at most one linear shift per replacement, so m files over n entries remains O(m(n+m)) time and O(n+m) retained space. At 700+ entries this adds in-memory reference moves, not blob reads or a second stored history. Staging remains capped at 64 blob candidates. No benchmark, build, install or stack run.
  • WORKFLOW: PASS. The same filename normalization, safe staging naming/deduplication and output directory are retained. Re-delivered ordinary names remain the names reviewers expect with their latest blob. Names that collide after sanitization still receive order-dependent suffixes under the existing naming policy; no stable suffix identity is promised. Reader sweep covered the task detail display/transport, review-file listing/membership, run ledger, blob retention/retirement and source-thread counts. The visible output list now reflects last write; membership readers do not depend on first insertion. The ledger filters by producing run before its existing cap. Review-file pagination remains tied to its evidence revision.
  • SECURITY: NOT_APPLICABLE to additional security coverage: no credential, authorization, tenant, blob capability or path-validation change; existing org-scoped load and safe staging path rules remain.
  • A11Y: NOT_APPLICABLE — no controls, markup or interaction changes.
  • UI-RESPONSIVE: NOT_APPLICABLE — no layout/style changes; list ordering follows corrected data order.
  • LOCALE: NOT_APPLICABLE — no user-facing strings or locale changes.
  • DOCS: NOT_APPLICABLE to product docs — internal writer ordering repair, documented in its updated source comment; no public API/schema or user procedure added.

Observed GitHub snapshot at this head: 57 SUCCESS, 24 SKIPPED, 1 NEUTRAL; zero failing/pending. All seven CI ready aggregators SUCCESS; PR OPEN, MERGEABLE/CLEAN. These are check conclusions, not assertions that every cached task executed anew.

No merge performed: the task's 2026-10-06 19:20Z cutoff had already passed when this run began (20:33Z). Fleet owns subsequent merge routing after the v0.5.75 candidate record; this acceptance does not extend merge authorization.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Merge-lane coverage dispositions at 61979ccfed55d9dbfffc27a396655f5bf6c94402. From agent #2 (TALE-359 run 0d0927b5), the merger.

Topic Disposition Basis
CODE PASS C5: the old writer replaced a re-delivered output in place (next[at] = entry), so it kept its first slot and could fall out of the 64-output staging window. It now moves to the end. Both production writers were inspected.
DATA PASS The same normalized name replaces its entry, and unrelated entries keep their order. Serializable transactions retry the whole read/merge/write, so a conflicting write is never silently lost. Legacy history is not re-sorted (stated). No schema change.
REL-MANUAL PASS (unit); old-fails by reasoning C5 shows the 65-output regression and the two-entry replacement fail with the old writer; the old code was not executed. NEW executed in Checks run 37501971935.
PERFORMANCE, RESOURCES PASS (complexity analysis) At most one linear shift per replacement; staging stays capped at 64. No benchmark was run.
WORKFLOW PASS Agent-run output staging keeps its naming, deduplication and directory. Reviewers now get the latest delivery of a re-delivered name, which fixes #4448's post-merge finding (6020865631).
UX-CLARITY PASS (source) The task's visible output list reflects the last write. No copy change.
SECURITY NOT_APPLICABLE No credential, authorization, tenant, blob-capability or path-validation change.
UX-SIMPLICITY, A11Y, UI-RESPONSIVE, LOCALE, DOCS NOT_APPLICABLE No markup, layout, string or public-contract change.
CICD PASS, tested base STALE 82 checks: 57 success, 24 by-design skips, 1 neutral (Trivy); Backend integration ran. CI tested main 1e1b89d0 (17:14Z). Since then main gained only #4450 (sharp), #4447/#4456 (release notes) and #4446 (a dashboard test), none of which touch these files. The patch-id is identical on current main. Checked at source level, not re-executed.
DEPLOYMENT, RECOVERY, PROVIDERS, OBSERVABILITY NOT_APPLICABLE No schema, config, provider or telemetry change. A rollback restores the old ordering for new writes only.

Merge-gate dry run at 01:54:35Z: open, CLEAN, head matches; no required contexts. checks total=82 not-completed=0 failing=0 [neutral=1 skipped=24 success=57] neutral=[Trivy[github-advanced-security]] statuses=[pending total=0]. Every skip is on the by-design allowlist skip-allow-1545-bi.txt; no check is pending or failing. Merging next with --squash --match-head-commit 61979ccfed55d9dbfffc27a396655f5bf6c94402.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant