~bigbes/agents-dev · parade

main · last commit 13 days ago · 7g0stsfu

← Back to the parade

ah-1cx.13 [bug] kill-finalized runs record CostUSD 0 since the running path stopped parsing the stream Lined Up

status: open P3 bug milestone:v0.2.0
bd update ah-1cx.13 --claim bd close ah-1cx.13
Created byEugene Blikh
Ownerbigbes@gmail.com
Created2026-08-04T23:43:42Z
Updated2026-08-04T23:43:42Z
Description
Regression introduced by ah-1cx.1 and reported by the agent that made it.

Reconciler.killAndFinalize (internal/reconcile/reconcile.go:700) finalizes a stall- or deadline-killed run from the ports.RunStatus of the last RUNNING poll. After ah-1cx.1 that status deliberately carries no cost — the running path does only os.Stat + the bounded PeekSessionID, because a whole-stream cost sum has no cheap mid-run answer. Previously the killed run at least recorded a partial-stream sum; now it records 0.

Every other terminal path re-reads the complete stream before finalizing (both exit.json branches via finalizeFromExit, and the crash-confirmed branch, which ah-1cx.1 added for exactly this reason). The kill path is the one that was missed, and it cannot be fixed inside internal/runner alone.
Design
The runner needs to expose the finalize-time facts to the kill path. Two candidate shapes:
- have ports.Runner.Kill return the EventStreamInfo it can read once the process is down, or
- add an exported FinalizeFacts(taskID) the kill path calls after Kill returns.
The first is tighter (one round trip, and Kill is already the moment the stream stops growing); the second keeps Kill's signature clean. Note the stream is only guaranteed complete once ahub-run has finished teeing, which a kill does not wait for — so whichever shape is chosen must say plainly whether the cost it records is complete or best-effort, rather than implying the former.
Acceptance criteria
A stall-killed and a deadline-killed run both record a non-zero CostUSD when their stream carried one, and the honesty of that number (complete vs best-effort) is stated in the code and in SPEC section 9.

Depends on

  • ah-1cx — Hardening: post-audit bug sweep (2026-07-20) parent-child open

Depended on by

Nothing depends on this issue.

No comments.

  • Eugene Blikh added under epic ah-1cx · 2026-08-05T02:43:42Z
  • Eugene Blikh created the issue · 2026-08-05T02:43:42Z
  • Eugene Blikh added label milestone:v0.2.0 · 2026-08-05T03:10:44Z
Stored rows — what this pane was built from, as read
issues 1 row
id ah-1cx.13
content_hash 4b771ca56b604525519b8a0e712adeed7e83551d956c2bf7c7df476e080a1614
title [bug] kill-finalized runs record CostUSD 0 since the running path stopped parsing the stream
description Regression introduced by ah-1cx.1 and reported by the agent that made it. Reconciler.killAndFinalize (internal/reconcile/reconcile.go:700) finalizes a stall- or deadline-killed run from the ports.RunStatus of the last RUNNING poll. After ah-1cx.1 that status deliberately carries no cost — the running path does only os.Stat + the bounded PeekSessionID, because a whole-stream cost sum has no cheap mid-run answer. Previously the killed run at least recorded a partial-stream sum; now it records 0. Every other terminal path re-reads the complete stream before finalizing (both exit.json branches via finalizeFromExit, and the crash-confirmed branch, which ah-1cx.1 added for exactly this reason). The kill path is the one that was missed, and it cannot be fixed inside internal/runner alone.
design The runner needs to expose the finalize-time facts to the kill path. Two candidate shapes: - have ports.Runner.Kill return the EventStreamInfo it can read once the process is down, or - add an exported FinalizeFacts(taskID) the kill path calls after Kill returns. The first is tighter (one round trip, and Kill is already the moment the stream stops growing); the second keeps Kill's signature clean. Note the stream is only guaranteed complete once ahub-run has finished teeing, which a kill does not wait for — so whichever shape is chosen must say plainly whether the cost it records is complete or best-effort, rather than implying the former.
acceptance_criteria A stall-killed and a deadline-killed run both record a non-zero CostUSD when their stream carried one, and the honesty of that number (complete vs best-effort) is stated in the code and in SPEC section 9.
notes
status open
priority 3
issue_type bug
assignee NULL
estimated_minutes NULL
created_at 2026-08-04T23:43:42Z
created_by Eugene Blikh
owner bigbes@gmail.com
updated_at 2026-08-04T23:43:42Z
closed_at NULL
closed_by_session
external_ref NULL
spec_id
compaction_level 0
compacted_at NULL
compacted_at_commit NULL
original_size NULL
sender
ephemeral 0
wisp_type
pinned 0
is_template 0
mol_type
work_type
source_system
metadata �{}
source_repo
close_reason
event_kind
actor
target
payload
await_type
await_id
timeout_ns 0
waiters
hook_bead
role_bead
agent_state
last_activity NULL
role_type
rig
due_at NULL
defer_until NULL
no_history 0
started_at NULL
is_blocked 0
labels 1 row
issue_id ah-1cx.13
label milestone:v0.2.0
dependencies 1 row
id 8514c08a-7c32-568f-a432-0aebe8d26420
issue_id ah-1cx.13
type parent-child
created_at 2026-08-05T02:43:42Z
created_by Eugene Blikh
metadata �{}
thread_id
depends_on_issue_id ah-1cx
depends_on_wisp_id NULL
depends_on_external NULL
events 2 rows
id 019fcf29-5cb0-7c15-944a-607975e1066e
issue_id ah-1cx.13
event_type created
actor Eugene Blikh
old_value
new_value
comment NULL
created_at 2026-08-05T02:43:42Z
id 019fcf42-1bf0-7298-9d5b-260af849def3
issue_id ah-1cx.13
event_type label_added
actor Eugene Blikh
old_value NULL
new_value NULL
comment Added label: milestone:v0.2.0
created_at 2026-08-05T03:10:44Z