René's URL Explorer Experiment


Title: feat(coderd/x/chatd): bill interrupted tool batches on cancellation rows by jaaydenh · Pull Request #28362 · coder/coder · GitHub

Open Graph Title: feat(coderd/x/chatd): bill interrupted tool batches on cancellation rows by jaaydenh · Pull Request #28362 · coder/coder

X Title: feat(coderd/x/chatd): bill interrupted tool batches on cancellation rows by jaaydenh · Pull Request #28362 · coder/coder

Description: Stack: #28359 → #28360 → #28361 → #28362 (this PR) Summary Interrupted local tool batches now bill the partial window they actually executed, recorded on the same dedicated usage record completed batches use. Completes the runtime billing work in this stack: completed batches bill via #28360, interrupted batches via this PR. Last of a four-PR stack splitting #28211. Stacked on #28361. Closes CODAGT-928 (https://linear.app/codercom/issue/CODAGT-928/track-local-tool-execution-for-agent-runtime). Problem Interrupting a batch previously billed only the model window; work the tools already performed was lost. Fix Just before closing the buffer episode, the interrupt task reads the live tool stamps (ToolCompletions) alongside ModelInvokedAt. The interruption commit appends the shared batchUsageMessage record (same shape as #28360: model-only tool-role row with a billed_ms/billed_calls audit payload) billing the union of the started, billable calls' partial execution intervals: completed calls end at their recorded completion, running calls at the interrupt instant. Synthesized cancellation rows stay free of batch-level runtime. Unstarted calls, rejected calls, and sub-agent orchestration tools bill nothing and append no record. Batches with no live attempt (crash recovery, state promotion) bill nothing, consistent with generation losing in-flight runtime on a crash. Usage-record billing reuses the same interrupt instant as the model window instead of taking a second clock reading inside the transaction, so database delay cannot inflate a running call's window. An earlier revision carried a retry-stable episode snapshot so an interrupt retry after buffer eviction (a >15s stall) would not lose billing; it was dropped as not worth the complexity (#28211 (comment)). Such a retry now bills the batch at zero, matching the existing crash-recovery precedent. Known gaps left out of scope: retry backoff and errored-attempt time stay unbilled (no persistence home for error turns), and the advisor tool's nested model call now bills as tool time by design.

Open Graph Description: Stack: #28359 → #28360 → #28361 → #28362 (this PR) Summary Interrupted local tool batches now bill the partial window they actually executed, recorded on the same dedicated usage record completed b...

X Description: Stack: #28359 → #28360 → #28361 → #28362 (this PR) Summary Interrupted local tool batches now bill the partial window they actually executed, recorded on the same dedicated usage record completed b...

Opengraph URL: https://github.com/coder/coder/pull/28362

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6de73050-b0d3-dc1d-4ced-0a422a8f6700
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9036:1F2F:C6152F:10814D6:6B01B221
html-safe-noncec678dc9a06893a8b4a0fd83ea52921798aefc82ac2ad88266862b3782a082e01
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDM2OjFGMkY6QzYxNTJGOjEwODE0RDY6NkIwMUIyMjEiLCJ2aXNpdG9yX2lkIjoiMTMyMzQ4MDQ5NDU4NjgzNTQ4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6c27758b44dcd5637ab9d162417c1b7579feaf0762fe25fa0c24b36a518f300f
hovercard-subject-tagpull_request:4321212768
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/coder/coder/pull/28362/files
twitter:imagehttps://avatars.githubusercontent.com/u/1858163?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1858163?s=400&v=4
og:image:altStack: #28359 → #28360 → #28361 → #28362 (this PR) Summary Interrupted local tool batches now bill the partial window they actually executed, recorded on the same dedicated usage record completed b...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/coder/coder/pull/28362/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fpull%2F28362%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fpull%2F28362%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/pull/28362/files
Reloadhttps://github.com/coder/coder/pull/28362/files
Reloadhttps://github.com/coder/coder/pull/28362/files
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues320 (320)https://github.com/coder/coder/issues
Pull requests470 (470)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fcoder%2Fcoder%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcoder%2Fcoder%2Fissues%2Fnew%2Fchoose
jaaydenhhttps://github.com/jaaydenh
mainhttps://github.com/coder/coder/tree/main
jaayden/codagt-928-stack-4-bill-interrupted-tool-batcheshttps://github.com/coder/coder/tree/jaayden/codagt-928-stack-4-bill-interrupted-tool-batches
Conversation 7 https://github.com/coder/coder/pull/28362
Commits 4 https://github.com/coder/coder/pull/28362/commits
Checks 57 https://github.com/coder/coder/pull/28362/checks
Files changed https://github.com/coder/coder/pull/28362/files
Please reload this pagehttps://github.com/coder/coder/pull/28362/files
feat(coderd/x/chatd): bill interrupted tool batches on cancellation rows https://github.com/coder/coder/pull/28362/files#top
Show all changes 4 commits https://github.com/coder/coder/pull/28362/files
7002a6a feat(coderd/x/chatd): bill interrupted tool batches on cancellation rows jaaydenh Aug 20, 2026 https://github.com/coder/coder/pull/28362/commits/7002a6aec11eae78e06519334a7d68b64a8e83a4
249b8c6 refactor(coderd/x/chatd): read interrupt billing stamps directly from… jaaydenh Aug 20, 2026 https://github.com/coder/coder/pull/28362/commits/249b8c625316fe5b59c5449d968e4f6a6b216c92
944d50f chore: update architecture.md jaaydenh Aug 24, 2026 https://github.com/coder/coder/pull/28362/commits/944d50f64b350e6c5f4a758e3a766a69c1bfa3af
32e9e8e refactor(coderd/x/chatd): bill interrupted tool batches on a dedicate… jaaydenh Aug 24, 2026 https://github.com/coder/coder/pull/28362/commits/32e9e8ecbcb6adcb5128b3862decc5e3c81a598d
Clear filters https://github.com/coder/coder/pull/28362/files
Please reload this pagehttps://github.com/coder/coder/pull/28362/files
Please reload this pagehttps://github.com/coder/coder/pull/28362/files
tasks.go https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
tasks_test.go https://github.com/coder/coder/pull/28362/files#diff-af7e22c79d9c4821aef8979ac45931a9816009a7f8df63bfef299e569b82253e
coderd/x/chatd/tasks.gohttps://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
View file https://github.com/coder/coder/blob/32e9e8ecbcb6adcb5128b3862decc5e3c81a598d/coderd/x/chatd/tasks.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/coder/coder/pull/28362/{{ revealButtonHref }}
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
https://github.com/coder/coder/pull/28362/files#diff-12836e96198832ba2e387a5908311c071c67150af3b4870e188f6cb99e6b49ad
Please reload this pagehttps://github.com/coder/coder/pull/28362/files
Please reload this pagehttps://github.com/coder/coder/pull/28362/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.