Repository navigation
fix(core): keep build job notices out of the transcript, and close jobs of a chat being deleted - #411
Merged
Merged
Conversation
…bs of a chat being deleted
nickruigrok
marked this pull request as ready for review
October 11, 2026 16:37
Contributor
Author
|
@greptileai review |
|
Contributor
Author
|
@greptileai review |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
GRA-443: follow-ups from the post-merge audit of #409 (Code Mode build jobs).
recentHistorysends every system message andmeasureTurnssubtracts them all, so after a few hundred notices every question failed withagent.question_too_long, and old notices pointed at pruned jobs.keeppasses over them by content, so they are never written tochat_messagesand leave the prompt with their turn.env.build.job.deleteChatnow cancels the chat's jobs and terminates their instances right after marking the chat deleting, before it awaits connect.admitFromBuildJobalso refuses any job of a chat in#deleting. If the delete then fails, the jobs stay cancelled.failDeadJobs) orfinishran after a step failed for good. It then ends withbrokenOff(version): "ended unexpectedly after committing version N, which is proposed for review. Don't propose it again". Only a job that committed nothing is told to submit again. The receipt lookup is shared in the newbuild-job-receipts.ts.build-jobs.ts): any revocation of the agent's permissions still ends a job. A revocation narrows the agent's authority; a job mustn't outlive it on a guess at which grants it rests on, and a job is cheap to submit again.admitJob's doc now says its own check runs first and last.buildJobInputSchema,admitJobandmaxRunningJobsare no longer exported.reconcileReceiptnow reads plainly.codeRunRetention()stays: workerd exposes every public method of a Durable Object, it returns only counts, and the tests need the object's own private state.How it was tested
apps/core/test/build-jobs.test.tsnow has 21 tests, in workerd against the real engine, DO, model loop and D1.Changed test
New tests
deleteChatwaits on connect. The job endscancelledand no version is created.job()then reportsfailedwithversion: 1and an error that names the commit, not "Submit it again".revokedwith no result. Role loss in finish for a check job was already covered.Mutation checks. Each was applied on its own and reverted:
brokenOff(null)after a commitRemoving either deletion guard alone keeps that test green, because the other guard still refuses: the two are deliberate defence in depth.
Regression:
build-jobs.test.ts,agent.test.ts,chats.test.tsandagent-builds.test.tspass: 162 tests, 3 workers.vp checkandvp run check:migrationspass.Checklist
vp checkand targetedvp testpass