Repository navigation
factory: WorkAF r8 engine fixes — finished-before-quit run, outcome note by meaning, nothing to change - #2518
Merged
Conversation
… notes by meaning; nothing-to-change reads so - An agentfield step whose run ended while the step was still running (quit seconds after the run finished) is no longer stamped machine_lost: the lease queues it, and the round a restart picks up (Job.Continuing) reads the run's end as the step's instead of dispatching a second run. - The post-end drain is bounded by the reading's context, so a closing engine is not held for afStopDrain. - The outcome note is chosen by what it says (no pull request / empty change > failure > progress), not by being newest. - A run that changed nothing ends done with state_presentation "Nothing to change" and its detail sentence, not shipped silently. - "resumed" is not said when a revived job only waits on an AgentField approval; the readiness line shows a 7-char commit.
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.
Engine fixes from WorkAF live e2e round 8 (
~/factory-e2e/workaf-ab-r8/SUMMARY.md).1. A run that finished just before ⌘Q came back "Runner went offline mid-step" (job 77)
Cause: the run ended 17:18:25.7Z and its end + PR were on the job, but
followwas still in its post-end drain (acontext.Background()wait of up to 15 s) when the quit came. The hold then expired andlease.queueJobstampedmachine_lost(Manual → no retry).factory.AgentFieldRunOwed: an AF run that ended while its step is still running, started no earlier than the step's round, is owed a reader, not a failure.queueJobqueues it with no failure.factoryrun.Job.Continuing(set by the loop for the round a restart revived):afRemote.Stepreads that ended run's outcome (PR, words) instead of dispatching a second run. A fresh round (Run again / Try again) still dispatches.TestTheRoundARestartPicksUpReadsItsRunsEndInsteadOfStartingAnother,TestRecoveryARunThatEndedThisRoundIsReadNotLost,TestTheDrainAfterARunsEndStopsWhenTheEngineCloses.TestRecoveryAnEndedRemoteRunIsStillAnInterruptedStepnarrowed to a run that ended before the round began.2. Failed build headline was the finalize note (job 84)
afOutcomeNotenow usesfactory.AgentFieldTellingNote: notes ranked by meaning (no PR opened / empty change > any failure > progress), newest within a rank. No pipeline or step names. Test uses r8's exact note order (finalize 8 ms after "No pull request").3. A run that changed nothing ended "shipped" silently (job 79)
Detected generically from the run's notes/summary (
No commits between|ahead,changed nothing,nothing to commit…). The step ends done (not a failure), outputNothing to change: the run made no changes, so no pull request was opened.state_presentation.detail(titleNothing to change), set inapi.PresentJobfor a done job withdone_how: "answered"(no PR) whose step output is that sentence.failurestays null. State staysdone, so desk PR debug record: one switch, one recorder, a run id and a call id on every record, and a trace folder that is a person's own data #339's finished-job path keeps it in All jobs. The job log says the sentence instead of "the AgentField run finished".4. Quit with jobs running: "local factory took 10s"
Cause found: the 10 s is
appLocalStopWait. The runner loop could not finish because a step stayedRunningafterWithdraw: the AF drain above (job 77 was in it at ⌘Q). Each job'sletGowaitsStopWait(5 s) andsettleAccountingup to 5 s more, which is exactly 10 s. With the drain cancelled, AF steps release at once. AF runs keep going on the control plane. Native turns stop as before.Not done here: an explicit lease hand-back at quit. Leases still expire into the queue, so restart re-takes them in about 1 min. That path is the "mac idle CPU" lane's held-job/lease area, and there is no worker done-state for "let go, still running". Conversation close (6.9–16.9 s in r8) is separate and not touched. Not measured on a mac in this PR.
5. Low
reviveno longer says "resumed" when the job only waits on an AgentField approval or has no step left.Manual:
factory-agentfield.md(restart after a finished run, how the outcome note is chosen, new "an AgentField run that changed nothing" section) andfactory-stage-conversations.md.🤖 Generated with Claude Code