chore(cron): remove confirmed dead code in the cron and task surface - #6951
Conversation
Two symbols, confirmed unreachable by a three-scanner pass (vulture whole-repo, AST, tokenize) plus a full-repo search across py/ts/tsx/js/md/json/yml/yaml/ toml/sh/ps1 including docs/, system-specs/, builtin_skills/, skills/, config/, config-baseline.json, .github/ and pyproject entry points. STOP_SENTINEL (autonudge.py) was its own sole occurrence repo-wide. The live kill switch is stop_sentinel_path, a caller-supplied absolute path that _timer stats directly, and the three real consumers (issue_radar, spec_builder, auto_research) each declare their own "STOP" filename rather than importing this one. TaskRunner._run_tests was a three-line shim over task_executor.run_tests, whose guard is already duplicated in production. Its only two references were self-tests of the shim; the four apparent hits in test_taskrunner_v2_scenarios are a local stub of the same name used as a patch side_effect. The run_tests import goes with it (sole consumer) and self._test_cmd is unaffected, still read where the prompt is built. Behaviour unchanged; no reformatting, no refactoring.
Design Review (Fable 5) — ✅ PASSDesign-level review of All description claims verified against the tree: zero residual references to Design-Verdict: PASS Two provably unreachable symbols deleted with airtight cross-reference evidence, honest deferral of everything ambiguous, and no design-level concerns. [DESIGN-REVIEWED] c3b4aa7 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All claims verified independently: First-Principles-Verdict: PASS Pure subtraction with every deletion's deadness independently verifiable — this is the change this lane exists to encourage. What this change shipsIntent: delete two confirmed-dead symbols found by a cron/task-surface dead-code audit — a FIX (of accumulated surface), removal-only.
WatchThe description's "Needs a maintainer decision" list correctly identifies [FIRST-PRINCIPLES-REVIEWED] c3b4aa7 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Independently verified every removed symbol (grep across full repo + PR head, string/dynamic/registry lookup checks) has zero remaining references anywhere -- no dangling handler/registry entry (the #6876 defect class). CI all green. Approving.
Dead-code audit of the cron / task / workflow / eval group. Two symbols confirmed unreachable and deleted; 30 candidates rejected or deferred with reasons; five design gaps surfaced that are not dead code and are left untouched.
Deleted (2 symbols, 32 lines)
STOP_SENTINEL—src/kiro_crew/autonudge.pyIts own sole occurrence repo-wide. Searched
*.py *.ts *.tsx *.js *.md *.json *.yml *.yaml *.toml *.sh *.ps1plusdocs/,docs/system-specs/,builtin_skills/,skills/,config/*.md,config-baseline.json,error-code-baseline.json,.github/,Makefile,scripts/,pyproject.toml— zero hits. No__all__in the module, no import-under-alias, nogetattr, no module-attribute lookup onautonudge.The kill switch it appears to name is not wired through it. The live mechanism is a caller-supplied
stop_sentinel_pathresolved byresolve_stop_sentinel(autonudge_authz.py:53-57) and stat'd directly in_timer(autonudge.py:1573-1575,Path(loop.stop_sentinel_path).exists()). The three real consumers each declare their own filename rather than importing this constant:apps/builtins/issue_radar/backend/crew_runtime.py:437 —return d / "STOP"apps/builtins/spec_builder/backend/routes.py:201 —_STOP_FILE = "STOP"apps/builtins/auto_research/handlers.py:1759 — inline"STOP"30-day gate: introduced
849a03fff, 2026-07-16 (45 days). The stop-sentinel test (test_autonudge.py:579-594) passes unchanged.TaskRunner._run_tests—src/kiro_crew/taskrunner.pyThree-line shim over
task_executor.run_tests(live attask_executor.py:702). Itsif not self._test_cmdguard is already subsumed by production'sif auto_test and test_cmdattask_executor.py:701. No production caller, no subclass caller, no string dispatch, no method table, no docs mention.The four apparent references at
test_taskrunner_v2_scenarios.py:1751/1764/1984/1989 are a local function of the same name passed asside_effectwhen patchingkiro_crew.task_executor.run_tests— not references to the deleted method. Verified by reading each site.30-day gate: 2026-07-16 (45 days).
Companion removals:
run_tests,entry in thefrom kiro_crew.task_executor import (...)block attaskrunner.py:27-31 — sole consumer was the shim, would fail F401. This block is not the public re-export block, which begins at:33marked# noqa: F401; nothing importsrun_testsfromkiro_crew.taskrunner.class TestRunTestsintest/test_taskrunner_coverage.py— both tests calledrunner._run_tests()directly, i.e. self-tests of the shim, never the production path.Cascade checks:
self._test_cmdstays live (set at:284, read in production at:1169where it is passed intoexecute_single_task)._runner(88 uses),tr(12),AsyncMock,patch,Pathall still used in the test file. Zero residual references to either deleted symbol.Candidate generation
src/kiro_crew+test)ast.NodeVisitorvisit_*dispatch and__post_init__/__repr__dunders)Triple-intersection =
STOP_SENTINEL. Union = 32, all confirmed individually.Rejected as alive (5)
ScriptContext—cron_script.py:274:654imports it,:665doesctx = ScriptContext(job=job)in generated source. Invisible to any AST scan. Documented cron-script SDK. Deleting it breaks every script cron.append_heartbeat_task—heartbeat.py:65config/prompt.md:128 andconfig/prompt-orchestrator.md:263 both tell the model to callkiro_crew.heartbeat.append_heartbeat_task(entry)and forbid editingHEARTBEAT.mddirectly.ctx.send_slack—workflows/__init__.py:181,runner.py:552ctxDSL, string-called by author scripts. Wired port atrunner.py:312, gated by conformance D5, documentedworkflows.md:277, used by the shipped exampleexamples/workflows/03_scheduled_triage_native.py:68.content_chars,result_bytes—events/kinds.py:43, 83events/backfill.py:283 and :385.use_24hour_time_format—cron.py:765cron_descriptor.Options()object. Not our symbol.Deferred (25)
Rule: documented public surface — report only.
ack_job/unack_job(cron.py:2735, 2767) are superseded by their_asyncsiblings in every production caller, but both names appear inlearn-cron-dashboard.md:65, in theCronStoreBusydocstring atcron.py:436-437, and in the_CRON_WRITESfrozenset whose guard test assertscallable(getattr(CronService, name))— removal is a spec + guard edit, not a code deletion. Same rule holdscurrent_run(taskrunner.md:172),_persist_runs(documented twice as a "synchronous compatibility/testing helper only"),register_internal_read_path(an edition CPP seam atplatform-context.md:930 whose whole class is caller-free in OSS by design —register_selectable_backendandregister_embedding_backendalso have zero in-tree callers),serialize_events/deserialize_events,score_locomo/score_longmemeval,compare_interleaved/sensitivity_check, and_open_in_pinned_parent.Rule: inside the 30-day gate.
_save_snapshot(hooks.py:4147, 2026-08-06, 24d) — genuinely superseded,fire()now persists via_persist_current()→_save()under mutex.is_evidence_onlyandrecall_ceiling_note(both 2026-08-12, 18d);recall_ceiling_noteis a superseded inlined duplicate ofrun.py:213_ingest_warnings, which emits the same sentence with injection attribution the property lacks.Rule: test-referenced with no production caller ⇒ refactor, not deletion. Six pure pass-through shims in
taskrunner.pywhose delegates production calls directly —_normalize_cross_group_deps,_build_task_prompt,_save_progress,_load_checkpoint,_build_resume_context— plusruns_dir(workflows/store.py:96, whose six internal uses all go toself._runs_dir). Their tests assert the delegate's behaviour and reach it through the shim; several are shared fixture helpers seeding ~10 unrelated tests each._run_testsis the one shim that escaped this rule: its only two tests tested the shim itself.Needs a maintainer decision — not touched
AutoNudgeService.stop()has zero production callers. Its docstring atautonudge.py:365 claims "stop()is reached from SYNCHRONOUS callers — the gateway's shutdown path and test…", but the gateway shutdown block atslack/gateway.py:8528-8532 stopscron_svcandheartbeat_svconly;autonudge_svcis absent.stop()cancels all timers and clears_INSTANCE, so without it nudge timers and the module singleton survive shutdown. A half-wired lifecycle whose deadness is the defect — looks like a one-line gateway fix.serialize_events/deserialize_events". Real write isregistry.py:185to_store_json→store.pyjson.dumps; real read isregistry.py:234[WorkflowEvent.from_json(e) for e in obj.get("events", [])], which skipsdeserialize_events's array-shape check and its per-eventvalidate_eventloop. Fully-orphaned pair plus a spec-vs-code disagreement.WorkingMemory.files_changedhas no production writer.update_from_result(task_models.py:81) is its only writer and has no callers, while the reader is live (summary()←taskrunner.py:1222,task_executor.py:756) — so the prompt's "Files Changed" section is permanently empty in production.test_taskrunner_v2_scenarios.py:2545 records "In V2,update_from_resultwas removed": the call site was deleted, the writer was not. Either rewire it or delete the writer plus the field.eval/bench/scorers.py+stats.pyare an unwired half-module, not four dead functions. Neither is imported anywhere undersrc/;bench/__init__.pywires onlycorpus/datasets/ingest/retrieval/run, andcli_bench.py's subparsers arelist/fetch/retrieval/compare— the retrieval half only. Butbench/__init__.py's own docstring documents.scorers/.statsas the answer-metric half of the design, andscore_locomocarries 307 lines of live logic (normalize_answer,token_f1,multi_answer_f1,refusal_score,aggregate). Authored-but-unwired; the remedy is abench scoresubcommand, not deletion.TaskRunner(auto_commit=…)is a documented knob that does nothing.taskrunner.py:272 assignsself._auto_commit; nothing ever reads it, and the parameter appears intaskrunner.md:146. Deleting only the attribute would leave the parameter silently ignored — the same defect, less visible; deleting the parameter is an API change.Two rotted tests found in passing
test/test_hooks_json_shared_file.py:91 asserts in its docstring that "the asyncfire()path writes through_save_snapshot, not_save". False since1f91027dc. The test passes only because it calls_save_snapshotdirectly, so the realfire()→_persist_current()seam is uncovered.test_taskrunner_v2_scenarios.py::TestScenarioCheckpointResumeWithGitis vacuous: it patchesrunner._load_checkpoint, butrun()calls the module-levelload_checkpoint(spec_path)attaskrunner.py:970, so the patch never fires. Itsresult.tasks[0].status == PASSED # from checkpointassertion passes because the test's own_mock_exec_stepssets every PENDING task to PASSED. Checkpoint-resume-with-git has no real coverage.Verification
flake8clean ·isort --checkclean · 536 affected tests pass (test_taskrunner_coverage+test_autonudge214;test_taskrunner,test_taskrunner_v2_scenarios,test_plan_mode,test_scenarios_v2_logic,test_taskrunner_atomic_persistence,test_run_tests_reap322).Two local reds are pre-existing on
origin/mainand reproduce on the unmodified tree (verified bygit stash), so they are untouched:black --check test/test_taskrunner_coverage.pyfails because the local Python 3.12 cannot AST-verify code targeting 3.14, andtest_autonudge.py::TestSentinelPathRepair::test_unnormalized_path_escaping_legacy_is_preservedasserts.kiro/crewis absent from a$HOME-derived path, which does not hold where$HOMEis/local/home/....Reviewed locally before push by two independently pinned reviewers (
gpt-5.6-sol,claude-opus-4.8), each asked to falsify the safety claim across seven specific angles including the kill-switch question and the re-export-block question. Both returned no findings.Behaviour unchanged. No reformatting, no refactoring, nothing outside the audited group.