You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Report the last finished attempt in telemetry #243
Between attempts and alongside a running one, telemetry reports the last finished attempt: issue, title, outcome, tokens, turns, finish time and pull request. The value survives agent restarts.
Acceptance criteria
The published pull request's number and URL are written into the attempt's archive record at publication.
The telemetry module gains finish_attempt(summary), called at finalisation, which updates last_finished in memory.
At startup last_finished is seeded from disk: the latest completed attempt, with its token budget and pull request from that attempt's archive record. With no completed attempt it is null.
Shape: {attempt_id, issue_number, issue_title, outcome, finished_at, budget_used, turns, pull_request: {number, url} | null}. budget_used and turns are figure objects (measured). Archives written before this change give pull_request: null and an unknown title.
Tests: finishing an attempt updates last_finished; a restart seeds it from disk; with no history it is null; it is reported alongside an active current_attempt.
Implemented the last-finished attempt telemetry end to end on branch agent/issue-243 (work uncommitted; sealing will commit it).
simple_coding_agent/telemetry.py: finish_attempt(summary=None) normalizes
and stores last_finished (attempt_id, issue_number, issue_title, outcome, finished_at, budget_used/turns as measured figures, pull_request: {number, url} | null); legacy summaries seed title "unknown" and pull_request: null; malformed summaries log once and keep
the previous view. snapshot() now serves last_finished. Added load_last_finished(data_dir) built from the latest completed attempt
archive record.
simple_coding_agent/lifecycle.py: new data_dir constructor param with
startup seeding (_seed_telemetry_last_finished, never raises); _telemetry_finish(summary) passes summaries through; _archive_pull_request writes the PR into the archive at publication
(hooked into _publish_bounded, _publish_terminal, recovery retry); _commit_finalization writes issue number/title into the outcome record,
backfills the PR safety net, and finishes telemetry with the full summary; _write_outcome now returns completed_at.
simple_coding_agent/__main__.py: passes data_dir to AgentLifecycle.
New tests/test_telemetry_last_finished.py (15 tests): reporter shape,
legacy/unknown handling, unavailable figures, malformed-summary behavior,
finalisation wiring + archive PR, restart seeding, null with no history,
latest-wins seeding, alongside-active reporting.
code-review skill invoked this run: Standards (0 hard violations,
4 smells, worst = duplicated PR normalizer across telemetry/lifecycle) and
Spec (0 missing, 0 creep, 3 wrong-looking, worst = shared _build_failed_logged flag) reports aggregated in the run transcript.
Remaining work
Re-run tests/test_telemetry_last_finished.py (was 14/15 green; fixed the
malformed-summary log-count expectation from 2 to 1 to match the
log-once-per-episode pattern; re-run was blocked by the budget hook).
Decide on review findings: extract one shared PR normalizer (strongest
Standards finding); consider separate warning flags for snapshot vs finish
failures, timestamp parsing instead of string ordering in the archive scan,
and narrowing the except TypeError: finish() shim.
Run ruff check, full pytest on both gate Pythons (3.12 and 3.13).
Small docs touch: docs/agents/telemetry-snapshot.mdlast_finished
bullet (measured basis, legacy "unknown" title) and examples/telemetry/snapshot-idle-with-last-finished.json (budget_used
basis estimated -> measured to match the issue spec).
Commit the work on agent/issue-243.
Evidence
tests/test_telemetry_last_finished.py (new, untracked): 14/15 passing;
the single failure was the test's own log-count expectation, corrected to 1
(mirrors test_malformed_seed_keeps_the_previous_view_and_logs_once).
Touched files (uncommitted): simple_coding_agent/__main__.py, simple_coding_agent/lifecycle.py, simple_coding_agent/observability.py, simple_coding_agent/telemetry.py, tests/fakes.py, plus the new test file.
Gate not yet run: ruff + full pytest suites still pending.
Code-review gate satisfied: code-review invoked with both axes reported.
Automatic continuation 0/2 used; the agent will continue automatically.
Activity
lbacik commentedon Oct 14, 2026
Agent Attempt Result: handoff
Branch: agent/issue-243
PR: none
Handoff note commit:
12ee76b11939d0949eb71e0416b68376bb91ed17Evidence
UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest→ exit code NoneDetails
Handoff note: issue #243
Summary
Implemented the last-finished attempt telemetry end to end on branch
agent/issue-243(work uncommitted; sealing will commit it).simple_coding_agent/telemetry.py:finish_attempt(summary=None)normalizesand stores
last_finished(attempt_id,issue_number,issue_title,outcome,finished_at,budget_used/turnsasmeasuredfigures,pull_request: {number, url} | null); legacy summaries seed title"unknown"andpull_request: null; malformed summaries log once and keepthe previous view.
snapshot()now serveslast_finished. Addedload_last_finished(data_dir)built from the latest completed attemptarchive record.
simple_coding_agent/observability.py: addedread_latest_completed_attemptscanning
data_dir/logs/<issue>/<started>/attempt.json(skipsunreadable/incomplete records; latest by
(completed_at, started_at)).simple_coding_agent/lifecycle.py: newdata_dirconstructor param withstartup seeding (
_seed_telemetry_last_finished, never raises);_telemetry_finish(summary)passes summaries through;_archive_pull_requestwrites the PR into the archive at publication(hooked into
_publish_bounded,_publish_terminal, recovery retry);_commit_finalizationwrites issue number/title into the outcome record,backfills the PR safety net, and finishes telemetry with the full summary;
_write_outcomenow returnscompleted_at.tests/fakes.py:FakePublisher/PublishedAttemptacceptpull_request.simple_coding_agent/__main__.py: passesdata_dirtoAgentLifecycle.tests/test_telemetry_last_finished.py(15 tests): reporter shape,legacy/unknown handling, unavailable figures, malformed-summary behavior,
finalisation wiring + archive PR, restart seeding, null with no history,
latest-wins seeding, alongside-active reporting.
code-reviewskill invoked this run: Standards (0 hard violations,4 smells, worst = duplicated PR normalizer across telemetry/lifecycle) and
Spec (0 missing, 0 creep, 3 wrong-looking, worst = shared
_build_failed_loggedflag) reports aggregated in the run transcript.Remaining work
tests/test_telemetry_last_finished.py(was 14/15 green; fixed themalformed-summary log-count expectation from 2 to 1 to match the
log-once-per-episode pattern; re-run was blocked by the budget hook).
Standards finding); consider separate warning flags for snapshot vs finish
failures, timestamp parsing instead of string ordering in the archive scan,
and narrowing the
except TypeError: finish()shim.ruff check, fullpyteston both gate Pythons (3.12 and 3.13).docs/agents/telemetry-snapshot.mdlast_finishedbullet (measured basis, legacy
"unknown"title) andexamples/telemetry/snapshot-idle-with-last-finished.json(budget_usedbasis
estimated->measuredto match the issue spec).agent/issue-243.Evidence
tests/test_telemetry_last_finished.py(new, untracked): 14/15 passing;the single failure was the test's own log-count expectation, corrected to 1
(mirrors
test_malformed_seed_keeps_the_previous_view_and_logs_once).simple_coding_agent/__main__.py,simple_coding_agent/lifecycle.py,simple_coding_agent/observability.py,simple_coding_agent/telemetry.py,tests/fakes.py, plus the new test file.code-reviewinvoked with both axes reported.Automatic continuation 0/2 used; the agent will continue automatically.
Document last_finished measured basis and legacy seed values for #243
lbacik commentedon Oct 14, 2026
Agent Attempt Result: complete
Branch: agent/issue-243
PR: #253
Merge: auto-merge enabled (merge)
Evidence
UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest→ exit code 0Details
Claude SDK completed the implementation workflow.