Skip to content

diag(action): upload execution-output.json so #302 can be diagnosed - #408

Merged
max-sixty merged 2 commits into
mainfrom
diag/302-upload-execution-file
May 11, 2026
Merged

max-sixty merged 2 commits into
mainfrom
diag/302-upload-execution-file

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

  • Copy $EXECUTION_FILE into $LOGS_DIR/claude-execution-output.json from the Token usage step so it ships with the existing claude-session-logs artifact.
  • Targeted at token-usage.json under-reports turns and output_tokens when session uses run_in_background Bash #302: the action reads type:"result" entries from $RUNNER_TEMP/claude-execution-output.json, but that file is wiped at job end and the session JSONL we currently retain contains zero result entries — so we have no way to inspect what the SDK actually emits in an under-reporting run.

Why this and not the fix itself

The proposed aggregation fix (sum usage.* across all result entries, keep total_cost_usd from the last) is plausible but unverified. Without a real execution-output.json from a run_in_background: true session it's not knowable whether num_turns is per-event or cumulative-in-each-entry, so summing could under-correct or double-count. One under-reporting sample is enough to pin down the semantics and ship a regression-tested fix.

Test plan

  • Merge, then wait for any tend-mention or tend-review run that polls CI in the background to land an under-reporting token-usage.json.
  • Download the run's claude-session-logs* artifact, confirm claude-execution-output.json is present.
  • Run jq '[.[] | select(.type == "result")] | length' claude-execution-output.json — if more than 1, also dump each entry's num_turns and usage.* to determine the aggregation rule.
  • Open the follow-up PR with the corrected jq filter and a fixture from the captured file.

The session JSONL artifact has no `type:"result"` entries — the entries
the token-usage jq filter reads live only in
$RUNNER_TEMP/claude-execution-output.json, which is wiped at job end.
Copy it into the existing session-logs artifact so a real under-reporting
run can be inspected to determine whether `result` events are emitted
multiple times and what `num_turns`/`usage` look like in each.

Refs #302.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

let's isolate this to this repo only, so it doesn't affect consumers

Consumers shouldn't pay for an upload that only serves a tend-internal
diagnostic for #302. Match on $GITHUB_REPOSITORY so the cp is a no-op
elsewhere; gate goes away when the diag is dropped.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Gated on $GITHUB_REPOSITORY = max-sixty/tend in 25ddff0 — the cp becomes a no-op for every other consumer, so the diagnostic only ships logs from this repo. Gate vanishes when the block is dropped after #302 is resolved.

@max-sixty
max-sixty merged commit e02643d into main May 11, 2026
3 checks passed
@max-sixty
max-sixty deleted the diag/302-upload-execution-file branch May 11, 2026 02:29
@max-sixty max-sixty mentioned this pull request May 13, 2026
max-sixty added a commit that referenced this pull request May 13, 2026
Bumps generator to 0.0.18.

## Headline

Expose the `__TEND_DELETE__` sentinel so TOML overrides can reach RFC
7396 delete-key semantics — useful for dropping a generator-injected key
(e.g. `on.schedule` from a scheduled workflow) while keeping the rest.
Closes #439, thanks @jrdncstr for reporting.

## Other changes since 0.0.17

- fix(action): sum usage and num_turns across all result entries (#437)
- diag(action): upload execution-output.json (#408)
- fix(mention): run setup before PR checkout so stale PRs don't drop
mentions (#391)
- fix(running-in-ci): base skill worktree on default branch (#401)
- install-tend: fix oauth-token.sh returning an invalid token on macOS
(#398)
- oauth-token.sh: don't tee the OAuth token to stderr (#421)
- Skill hardening: bang-escape guidance, review-reviewers corruption
scans, dedup rules, $GITHUB_RUN_ID requirement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants