inb-120: surface historical-pipeline early-stop in Gitea workflow status #6
Reference in New Issue
Block a user
Delete Branch "inb-120-early-stop-exit-code"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the misleading Gitea Actions status on a partially-processed historical run.
pipelines/historical_pipeline.pypreviously returned 0 unconditionally frommain(), so a run that stopped onextract_permanent_failure(e.g. an Ollama 504 Gateway Timeout) still surfaced in the Gitea Actions list asconclusion: success. Run #929 on 2026-06-08 processed 6 messages of an estimated 3000-5000, hit the failure path, broke out, returned 0, and Gitea marked the run as a green tick — the most urgent operator UX issue for the historical backfill.What changed
EARLY_STOP_EXIT_CODE = 2inpipelines/historical_pipeline.py.loop_exit_reason: str | Noneinmain(); set to"extract_permanent_failure"on the failure break, left asNoneon clean EOF and on theLIMIT_OVERRIDEbranch (which is an operator-requested clean stop, not a failure).main()returnsEARLY_STOP_EXIT_CODEwhenloop_exit_reason is not None, otherwise 0.historical_run_early_stopstructured-log event withreasonandexit_codeso the operator dashboard can surface the cause.timeout-minutes: 720on the workflow) is untouched; it still surfaces as a cancelled job.pipelines/_tests/test_historical_pipeline_early_stop.pywith 6unittest.TestCasetests:test_early_stop_on_extract_permanent_failure_returns_nonzero— the regression.test_clean_eof_returns_zero— sanity check on the happy path.test_clean_eof_after_processing_returns_zero— sanity check after N messages.test_limit_reached_returns_zero—LIMIT_OVERRIDEis a clean exit.test_early_stop_exit_code_is_nonzero_and_distinct— guard the contract value (must be non-zero and not 1).test_early_stop_emits_diagnostic_event— the operator-dashboard signal.Acceptance
python3 -m unittest discover -s pipelines/_tests -p test_*.pyexits 0 with 16/16 tests passing (was 10/10 before this PR; +6 from the new file).Post-merge follow-up
Dispatch a fresh historical-pipeline workflow run and confirm the Gitea status flips to
failure(notsuccess) when the run hits the same Ollama 504 condition. The 12h cap and idempotent offset checkpoint are unchanged; resume behavior is preserved.Issue
a574d55887toa28cb5cdbd