Skip to content

fix: --ask-again does not re-ask while the lost question is still open #22

Closed

Description

@groupsky

Problem

A question whose Telegram message was lost cannot be asked again until it expires (approval_ttl, 12 h by default).

Seen on 2026-11-16 with v0.1.0, after #19: root wrote the question to the outbox, the listener could not read the file and removed it (level=WARN msg="bad outbox file, removed" ... permission denied). Root still logged result=asked, and pullgate status showed the question as open. Then:

  • pullgate status NAME --ask-again cleared the tip mark, but the next run logged result=nothing: decide in internal/gate/run.go returns Nothing when open != nil && open.SHA == tip, and --ask-again does not close the open question.
  • So the only ways out were to wait for the expiry or push a new commit.

Proposal

  • --ask-again also closes the open question for the tip (as closeOpen does), so the next run sends a new question with a new ID. An old Apply button for the closed question must not work (it already does not: approvals name the question ID).
  • The listener tells the owner when it removes a bad outbox file it could not read: a short notice "an outbox message of NAME could not be read and was removed; run pullgate status NAME --ask-again". It cannot read the text, but it knows the instance.

Done when

  • A test: an open question for the tip, then --ask-again, then a run sends a new question (new ID); an Apply for the old ID is refused.
  • A test: the listener removes an unreadable outbox file and sends one notice that names the instance and the command.
  • README "Config" or the status help says what --ask-again does with an open question.

Activity

  1. groupsky commented on Nov 17, 2026

    @groupsky
    ContributorAuthor

    Fixed in #35 (squash commit 38ecde6).

    Evidence for each "Done when" box:

    • Open question, --ask-again, new question with a new ID, old Apply refused: TestAskAgainReplacesALostQuestion in internal/gate/gate_test.go. Also TestAskAgainDropsAnApprovalWrittenBefore (a tap already in the inbox does nothing), TestAskAgainInAutoMode and TestAskAgainKeepsAnOpenQuestionForAnotherSHA.
    • The listener removes an unreadable outbox file and sends one notice with the instance and the command: TestBadOutboxFileTellsTheOwner in internal/listener/listener_test.go (one notice for an unreadable file and a broken file together, no file content in it). TestBadOutboxEntryThatStaysSendsNoNotice: no notice when the entry cannot be removed.
    • Docs: README ("Config", the --ask-again line), the status help in cmd/pullgate/main.go, DESIGN.md sections 7, 8 and 13, THREAT-MODEL.md T9.

    CI was green on all checks before the merge.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowDo when nothing else waits

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions