fix(forgejo): end the CI wait when the session has undelivered input #267
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck!267
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-264-ci-wait-interrupt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #264
What changed
forgejo_wait_commit_statusno longer holds a session hostage for the whole CI run. The wait stays blocking (this is not a park-and-resume redesign), but it gains an interrupt predicate:countPendingForgejoTriggersFor(repo, numbers, exceptAuthor)countspendingrows on the artifacts of this session (listForgejoSessionNumbers) that the agent did not author. The author filter is load-bearing: an implementer's own push leaves asynchronizedrow behind, and without it every call after a push would return instantly.CustomToolContext.hasQueuedMessages(), forwarded throughForgejoCallContext. This is the only live source for an interactive cockpit session, which has noforgejo_sessionsmapping.A new in-process hint bus (
forgejo/trigger-events.ts, modelled onci-status-events.ts) is fired fromForgejoDispatcher.pump()— the single funnel every insert path reaches — and wakes the sleeping wait, so latency is milliseconds instead of the 60 s fallback poll. The per-iteration predicate catches anything the bus missed.On interrupt the tool returns an error result (so a re-call is discouraged) whose text leads with the reason and still carries the full check report, plus
details.interruptedfor the tool card.donewins overinterruptedfor an all-terminal commit; a commit with no checks is interrupted immediately instead of sitting out the 30 s empty grace.Session identity reaches the tool through an explicit
sessionIdRefthreaded fromcreateSession/resumeSessionintoattach()(notctx.sessionManager.getSessionId(), which is a different id), following the existingfilterRef/uiBridgeRefpattern.The implementer prompt bullet, the tool description and
docs/configuration.mdwere reworded accordingly.Verification
bun test apps/server/src/forgejo/tools/ci.test.ts— three new loop cases: interrupt mid-wait carries its reason atwaitedMs: 60_000; all-terminal checks still reportdoneunder an always-firing predicate; a commit with no checks is interrupted atwaitedMs: 0without any wake.bun test apps/server/src/db/forgejo-triggers.test.ts— the count query excludes other repos, unlisted numbers, the agent's own rows (mixed casing on bothrepoandcomment_author) and non-pendingrows; an empty number list returns 0.pendingAcme/Widgets#7row byaliceand a session mapped toacme/widgets#7, the built tool returned in 3 ms (not 600 s) withisError: true, texterror: ended early: 1 unhandled Forgejo event(s) …plus the check report, anddetails.interrupted === true. Flipping the author to the agent's own login made the same call block until its 1 s timeout — own events do not self-interrupt.bun test— 1661 pass, 0 fail.bun run typecheckclean.