Skip to content

fix(openai): anchor PLACEHOLDER_RE so valid summaries mentioning "placeholder" are kept - #74

Open
detail-app[bot] wants to merge 2 commits into
mainfrom
detail/bug-fix/fix-openai-anchor-placeholder-re-so-valid-summarie-e55a14
Open

detail-app[bot] wants to merge 2 commits into
mainfrom
detail/bug-fix/fix-openai-anchor-placeholder-re-so-valid-summarie-e55a14

Conversation

@detail-app

@detail-app detail-app Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Bug

requestSentence (src/openai/requestSentence.ts) filters each submit_sentence tool-call answer through PLACEHOLDER_RE before returning it to the PR-summarization and repository-research tasks. The first alternative of PLACEHOLDER_RE was the bare, unanchored word placeholder, so RegExp.test matched the substring anywhere in any sentence — discarding legitimate substantive summaries that merely mention a placeholder (e.g. "Replaced the placeholder logo with a real project image").

Both callers always set the *FetchedAt timestamp but only persist the description when non-null, so a misclassified answer was routed into the intended "give up on this one" lane: the row left the retry queue with no summary saved and no retry attempted.

Fix

Anchored the first alternative to ^placeholder\b so only a sentence that starts with the stand-in token is rejected:

-const PLACEHOLDER_RE = /placeholder|^(no|not) .../i;
+const PLACEHOLDER_RE = /^placeholder\b|^(no|not) .../i;

The two ^(…) branches were already anchored and are unchanged; substantive summaries that mention a placeholder mid-sentence are now kept. The \b retains the stand-in catch ("placeholder", "Placeholder description") while not matching a longer word such as "placeholders" — intentional, since the stand-in is terse and leading.

Testing

  • Added a focused regression test, src/openai/requestSentence.test.ts, covering the PLACEHOLDER_RE keep/drop matrix (substantive "placeholder" summaries kept; leading stand-ins and the "no information"/"couldn't find" branches still rejected), NON_ANSWER_RE sanity, and the \b tradeoff. Regression-proof: reverting the regex to the unanchored form makes the 5 bug-fix assertions (plus the \b-tradeoff assertion) fail; the fix returns them to passing.
  • Unit tests, typecheck (npx tsc --skipLibCheck --noEmit), and build (npm run build) all pass; the sibling openai/format.test.ts and automation/aiScoreStandups.test.ts suites still pass.
  • To confirm the fix also reaches the caller persistence contract end-to-end, I wrote (unversioned) caller tests stubbing Prisma + OpenRouter via typedi and fetchPullRequest via the require cache. These confirmed that generatePrDescriptions and researchRepositoryDescriptions now persist substantive "placeholder" sentences (previously dropped to null), leading stand-ins are still dropped and marked terminal, and the PR caller still retries on error. Not included in the PR to keep the change focused on the one-line fix.
  • ESLint could not be run meaningfully: the pinned @typescript-eslint/parser@3 is incompatible with typescript@5 and emits a 0:0 DeprecationError on every .ts file (confirmed against an untouched file). There is no lint script and CI does not enforce lint; the change introduces no new lint issues.

Automatic Fixes PRs can be configured here.

@augmentcode

augmentcode Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor
🤖 Augment PR Summary

Summary: This PR narrows the OpenAI sentence placeholder filter to avoid discarding substantive summaries.

Changes:

  • Anchors the placeholder alternative in PLACEHOLDER_RE to the beginning of the response.
  • Retains the existing filters for “no information” and “could not find” non-answers.
  • Adds an offline regression test for the requestSentence tool-call pipeline.
  • Exercises substantive sentences that mention placeholder text, stand-in responses, and existing non-answer patterns.
  • Documents the intended word-boundary behavior for plural placeholder-prefixed words.
Why: The previous unanchored match rejected valid PR or repository summaries merely because they mentioned a placeholder.
Technical notes: requestSentence returns null for filtered responses, and its callers record attempted timestamps while only persisting non-null descriptions.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/openai/requestSentence.ts Outdated
// string instead of admitting they found nothing. Reject these the same way as a
// non-answer, rather than saving them as if they were a real result.
const PLACEHOLDER_RE = /placeholder|^(no|not) (specific |concrete |publicly )?(information|data|details) (is |was |)?(available|found)|^(i )?(could not|couldn't|was unable to) find/i;
const PLACEHOLDER_RE = /^placeholder\b|^(no|not) (specific |concrete |publicly )?(information|data|details) (is |was |)?(available|found)|^(i )?(could not|couldn't|was unable to) find/i;

@augmentcode augmentcode Bot Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still drops valid 5–10-word answers that start with placeholder, such as Placeholder logo was replaced with a real project image; both callers then mark the item fetched without saving it or retrying. That sentence is permitted by the prompts and is the same substantive-summary case this change intends to preserve.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 646347f: narrowed the leading-"placeholder" stand-in match to a bare token or one-word label so substantive sentences starting with "placeholder" (e.g. "Placeholder logo was replaced with a real project image") are kept; the regression tests now cover that and still reject bare/label stand-ins.

Narrow the leading-"placeholder" stand-in match to a bare token or one-word
label so a real 5-10-word summary beginning with "placeholder" (e.g.
"Placeholder logo was replaced with a real project image") is no longer
dropped. Both callers mark the row fetched without retrying, so the dropped
summary would be lost permanently.
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