Skip to content

fix(vulnogram): exit cleanly without a TTY and point to --pmc (#1733) - #1742

Merged
potiuk merged 2 commits into
apache:mainfrom
Kaap10:fix/vulnogram-setup-no-tty-1733
Oct 20, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
Kaap10:fix/vulnogram-setup-no-tty-1733

Conversation

@Kaap10

@Kaap10 Kaap10 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Detect non-interactive stdin (sys.stdin.isatty()) and handle (EOFError, KeyboardInterrupt) in vulnogram-api-setup, printing a clean error pointing to --pmc <project> instead of an unhandled traceback.
  • Protect resolve_from_address() against EOFError when prompting for an ASF account in a non-interactive shell without --from-address.
  • Prioritize --pmc <project> first in expired-token hints and documentation across skills and tool adapters.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other:

Test plan

  • Added unit tests in tools/cve-tool-vulnogram/oauth-api/tests/test_setup_session.py:
    • test_paste_prompt_without_tty_aborts_cleanly
    • test_paste_prompt_eof_aborts_cleanly
    • test_resolve_from_address_eof_aborts_cleanly
  • pytest test_setup_session.py (30 passed)
  • pytest test_issue_sync_rules.py (37 passed)
  • pytest test_cve_allocate.py (95 passed)
  • uv run ruff check and uv run ruff format --check passed cleanly

RFC-AI-0004 compliance

  • HITL — any new mutation is gated on explicit user confirmation
  • Sandbox — no new unrestricted host access; network reach declared in the adapter
  • Vendor neutrality — placeholders (<PROJECT>, <tracker>, <upstream>, <security-list>) used in all skill / tool prose (the check-placeholders prek hook is the mechanical gate)
  • Conversational + correctable — agentic-override path documented if behaviour is adopter-tunable
  • Write-access discipline — no autonomous outbound messages; drafts only, sent on confirmation
  • Privacy LLM — private content does not reach a non-approved LLM; redactor invoked where needed

Linked issues

Closes #1733

Notes for reviewers (optional)

Run from an agent shell escape (such as Claude Code's !), getpass raised EOFError because stdin lacked a controlling terminal. The browser-approval flow (--pmc <project>) works in the same environment. This PR intercepts the error, exits with status 1, and guides the operator to --pmc.

…#1733)

When executed from an agent shell escape or non-interactive environment,
the default paste flow of vulnogram-api-setup raised EOFError with an
unhandled traceback.

- Catch EOFError/KeyboardInterrupt and detect non-interactive stdin in
  setup_session.py to exit cleanly with code 1 and actionable instructions
- Protect the ASF account prompt in resolve_from_address against EOFError
- Mention --pmc <project> first in expired-token hints across client.py,
  push.py, skill guidance, and documentation
- Add unit tests covering non-interactive stdin and EOF handling

Generated-by: Antigravity
@github-actions github-actions Bot added family:security security-* skills family:tools tools/* family:docs Docs, MISSION.md, READMEs capability:intake Import external signal + sync tracker state contract:cve-authority Tool capability: CVE allocation / record management / publication substrate:analytics Tool substrate: read-only metrics / dashboards / renderers labels Oct 20, 2026
…ooping

getpass reads from /dev/tty before stdin, so a non-tty stdin does not mean
there is no terminal: drop the isatty() pre-check that rejected those runs.
After a --pmc fallback to the paste prompt, point at --token rather than
back at --pmc, and let Ctrl-C exit as before instead of reporting
"No terminal".

Generated-by: Claude Opus 5

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kaap10, the EOF handling fixes #1733. I pushed one small fixup commit (4647683) instead of a review round trip:

  • Dropped the sys.stdin.isatty() pre-check (and the autouse _interactive_stdin fixture and its test). getpass reads from /dev/tty first and falls back to stdin only when no terminal can be opened, so a non-tty stdin does not mean there is no terminal: the check rejected redirected runs that still had a working tty. The except EOFError already covers the #1733 case.
  • The no-terminal hint no longer loops. With --pmc, the paste prompt is only reached when the server has no browser approval, so the hint now says to pass --token <token> there instead of re-running with --pmc. A new test covers that fallback.
  • Ctrl-C exits as before. Catching KeyboardInterrupt reported "No terminal" for an interrupt at a working terminal, so both prompts now catch only EOFError.
  • README: the "Re-running setup is a 30-second operation" sentence now leads with the --pmc <project> browser approval.

ruff and the oauth-api tests (177) pass locally.


This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk enabled auto-merge (squash) October 20, 2026 20:20
@potiuk
potiuk merged commit c310916 into apache:main Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:intake Import external signal + sync tracker state contract:cve-authority Tool capability: CVE allocation / record management / publication family:docs Docs, MISSION.md, READMEs family:security security-* skills family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vulnogram-api-setup: paste flow fails without a TTY; point to --pmc

2 participants