Skip to content

fix: shutdown edge cases from the first review (q during start-up, deploys after Ctrl+C, stale lock) #3

Not planned

Description

@realRaghavGupta

Why

The first review of #1 found two blockers (fixed there) and eight smaller points. Two of them can still leave a GPU running briefly or start one for nothing, which goes against the repo's first rule: nothing that bills may outlive the session.

Acceptance criteria

  • Ctrl+C (or any cleanup) during a deploy stops deploy() from trying the next region: it checks an abort flag before each attempt (src/cloud.mjs, deploy)
  • A deploy still running when cleanup's 600 s wait ends cannot leave a service behind: cleanup deletes again once the deploy returns, or the wait has no cap while the deploy process is alive
  • q pressed during the deploy, download or warm-up stops the run and deletes everything, as the README says; a test shows it
  • The stale-lock check accepts only a runcoder process (for example the lock records the process's start time or full command), not any command line containing "runcoder"
  • A manual run on Windows: closing the console window during a session deletes the service within the time Windows allows; if it cannot, the README says to press q on Windows. Note who ran it and the result in this issue
  • README "Use" names the keys the code uses: c to continue, p to pick a session (it says r, which is "reopen" during a session)
  • The lock is written in one step (pid in place before the lock counts), so a second start in the same instant cannot take a half-written lock for a stale one
  • An unexpected error (the uncaughtException / unhandledRejection handler in bin/runcoder.mjs) also prints ERROR: and the Full log: path on screen, like the normal error path, not only to the log
  • Each behaviour change has a test on the fakes; pnpm check and CI pass on ubuntu, macos and windows

Files likely touched

src/cloud.mjs, src/session.mjs, src/ui.mjs, tests/1-run.test.mjs, tests/2-recovery.test.mjs, README.md

Risk class

normal

Activity

  1. added
    agent-ready
    on Dec 2, 2026
  2. lyra-setkernel commented on Dec 2, 2026

    @lyra-setkernel
    Contributor

    Opened #5.

  3. lyra-setkernel commented on Dec 3, 2026

    @lyra-setkernel
    Contributor

    Opened #6.

  4. lyra-setkernel commented on Dec 3, 2026

    @lyra-setkernel
    Contributor

    The agent run for @lyra-setkernel found nothing to do, so this issue is closed as not planned. Its evidence:

    Everything this issue asks for is on main, merged in PR #5 (2e61396) and PR #6 (d83c0a3). This branch has no diff against origin/main (git diff origin/main is empty). Where each point is on main:

    • Abort flag before each region: src/cloud.mjs:106-109 (deploy(s, onAttempt, aborted) returns at once when aborted() is true).
    • A deploy still running after cleanup's wait is deleted again once it ends: commit message of 2e61396; test tests/2-recovery.test.mjs:103 ("the fake service only appears when the deploy ends", then noService).
    • q during the deploy, download and warm-up stops the run and deletes everything: tests tests/1-run.test.mjs:73 (download) and :85 (deploy, no next region tried), both assert noService.
    • The stale-lock check accepts only the process that wrote the lock (pid plus full command line): src/session.mjs:35-44.
    • The lock is written whole, then linked into place in one step: src/session.mjs:18-24 (linkSync).
    • uncaughtException / unhandledRejection print ERROR: and Full log: on screen: bin/runcoder.mjs:51-59.
    • README "Use" names c and p: README.md:57-58.
    • Windows window-close: the README takes the criterion's fallback and tells Windows users to press q or Ctrl+C, not close the window (README.md:53-55, commit 4d41660). That note rests on Node's documented ~10 s Windows close limit. No agent can run Windows by hand, so no manual Windows run is recorded here. If the owner still wants one, it is a person's task and doesn't need more code.

    This run made no code change, so it ran no checks.

    Run: https://github.com/setkernel/hq/actions/runs/47032952196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions