🤖 refactor: auto-cleanup#3559
Conversation
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
141167e to
a913e8d
Compare
|
Failure: Run Why it's flaky / unrelated:
Action: None required for this PR. The flakiness lives in Generated with |
d4c35d0 to
2df82f7
Compare
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
Auto-cleanup pass note: the one failing check (
Per the auto-cleanup agent's "extremely low-risk, behavior-preserving" constraint, this pass does not attempt to fix the unrelated HistoryService test regression. Pausing for human direction on that pre-existing failure. |
|
What failed
Why it is not from this branchThe same 10 tests fail on
Root cause (pre-existing, from #3558)
ActionPer the auto-fixup scope ("only fix what the cleanup broke; do not add unrelated changes"), I did not push a fix. The fix belongs on |
2df82f7 to
9832d32
Compare
|
@codex review This pass replaces a duplicated |
|
To use Codex here, create a Codex account and connect to github. |
Deduplicate the `completedAt ?? startedAt` harvest-record ordering key in src/node/services/memoryConsolidationService.ts. After #3558 ("add memory harvest pipeline"), the same effective-time expression was computed inline four times across two functions that must rank records identically: - findNewestHarvestRecord picks the record with the max completedAt/startedAt. - pruneHarvestRecords sorts descending by the same key to keep the newest 20. Both now derive recency from one `harvestRecordTime(record)` helper, documenting that they must agree on "newest" so the format can't drift between call sites. Behavior-preserving: the helper returns the identical value, the reduce/sort comparisons are unchanged, and normalizeHarvestRecord's distinct `completedAt ?? Date.now()` (finalizing a stale record) is intentionally left inline. Verified with `bun test memoryConsolidationService.test.ts` (pass) plus eslint + tsc. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-8` • Thinking: `xhigh` • Cost: `n/a`_ <!-- mux-attribution: model=anthropic:claude-opus-4-8 thinking=xhigh costs=n/a -->
etl.ts redefined `export const CHAT_FILE_NAME = "chat.jsonl"` even though #3541 added the canonical constant in src/common/constants/paths.ts (and etl.ts already imports its sibling CHAT_ARCHIVE_FILE_NAME from there). Re-export the canonical constant instead so the "chat.jsonl" literal lives in one place; analytics consumers (workspaceDiscovery, tests) keep importing CHAT_FILE_NAME from ./etl unchanged. Behavior-preserving: identical value.
#3565 reintroduced a hardcoded startsWith("wfr_") in WorkflowRunner's nested-step drift detection. taskId.ts already exports the canonical WORKFLOW_RUN_TASK_ID_PREFIX and isWorkflowRunTaskId() predicate as the single source of truth for that prefix. Use the helper instead of the duplicated literal; behavior is identical (both are falsy for a missing taskId inside the find() predicate).
Extract the repeated "Failed to save automation." / "Failed to remove automation." fallback strings in AutomationModal.tsx into two module-level constants. Behavior-preserving: each call site now references an identical string constant.
9832d32 to
350dcee
Compare
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
Summary
Long-lived auto-cleanup PR maintained by the Auto-Cleanup Agent. Each pass lands at most one extremely low-risk, behavior-preserving cleanup drawn from recently merged
mainactivity, then advances the checkpoint below.This pass
Deduplicated two repeated fallback error strings in
src/browser/components/AutomationModal/AutomationModal.tsx, introduced by #3560 ("centralize workflow automations"). The literals"Failed to save automation."and"Failed to remove automation."each appeared three times across the save/remove flows (pre-check, RPC-result, and thrown-error/catchpaths). They are nowSAVE_AUTOMATION_ERROR_MESSAGEandREMOVE_AUTOMATION_ERROR_MESSAGEmodule-level constants, so the wording stays consistent if it ever changes.AutomationModal.test.tsxtests still pass.Validation
bun test src/browser/components/AutomationModal/AutomationModal.test.tsx— 13 pass / 0 fail.make static-check— eslint, tsc (both configs), and Prettier pass. The only failing step isfmt-shell-check, which requiresshfmt(not installed in this environment); no shell scripts were touched, so CI (which hasshfmt) is unaffected.Prior passes
"wfr_"literal insrc/node/services/workflows/WorkflowRunner.tswith the canonicalisWorkflowRunTaskId()predicate fromsrc/node/services/tools/taskId.ts(after 🤖 feat: add first-class nested workflows #3565). Behavior-preserving inside theArray.find()predicate (both forms are falsy for a missingtaskIdand perform the samestartsWithcheck for a present one)."chat.jsonl"literal insrc/node/services/analytics/etl.tsby re-exportingCHAT_FILE_NAMEfrom the canonicalsrc/common/constants/paths.ts(after 🤖 perf: rotate sealed chat history out of chat.jsonl at compaction boundaries #3541).harvestRecordTimehelper insrc/node/services/memoryConsolidationService.tssofindNewestHarvestRecordandpruneHarvestRecordsderive thecompletedAt ?? startedAtordering key from one place (after 🤖 feat: add memory harvest pipeline #3558).Auto-cleanup checkpoint: f96aa91
Generated with
mux• Model:anthropic:claude-opus-4-8• Thinking:xhigh• Cost:n/a