Skip to content

fix: make AI label selection reliable - #5

Merged
jwcesign merged 1 commit into
mainfrom
codex/fix-ai-label-json
Jul 29, 2026
Merged

fix: make AI label selection reliable#5
jwcesign merged 1 commit into
mainfrom
codex/fix-ai-label-json

Conversation

@jwcesign

Copy link
Copy Markdown
Owner

Why

The AI label prompt showed an invalid JSON example and parsed model output without validation. A response using Python-style single quotes therefore raised JSONDecodeError and turned the webhook request into an HTTP 500.

Proposed Changes

  • Request a deterministic JSON object from the model and validate its schema.
  • Treat malformed, empty, or failed AI responses as no label selection instead of failing the webhook.
  • Accept only existing repository label names, skip labels already applied, and prevent AI-created labels.
  • Add regression tests to CI and remove the unused workflow variable.

Validation

  • python -m unittest discover -s tests (6 tests)
  • pylint $(git ls-files "*.py") tests --max-line-length=240 (10.00/10)
  • python -m compileall -q app.py bots tests
  • docker build --platform linux/amd64 -t gitautomator:codex-test -f Dockerfile .
  • Python 3.10 tests inside the built image

Release Note

NONE

Signed-off-by: jwcesign <jiangwei@cloudpilot.ai>
@gitautomator

gitautomator Bot commented Jul 29, 2026

Copy link
Copy Markdown

Thanks to your contribution, the maintainers will review it as soon as they can!

@jwcesign
jwcesign merged commit bd1487e into main Jul 29, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant