Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/codex-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Trigger Codex Review

on:
pull_request:
types: [opened, reopened, labeled]
types: [opened, reopened, labeled, synchronize]

jobs:
trigger:
Expand All @@ -13,9 +13,26 @@ jobs:
with:
github-token: ${{ secrets.FUUGAMO_PAT }}
script: |
const prNumber = context.payload.pull_request.number;
const pingText = '@codex Please review this PR. If you find no critical issues, reply with "LGTM". If you find critical issues, describe them clearly.';

// 去重:如果已存在相同触发评论则跳过,避免重复@codex
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100,
});

const alreadyPinged = comments.some(c => (c.body || '').includes(pingText));
if (alreadyPinged) {
core.info('Codex already pinged on this PR, skip duplicate comment.');
return;
Comment on lines +27 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow synchronize events to post a new Codex ping

The de-dup check returns as soon as any historical comment contains pingText, so once one ping exists, all future synchronize runs skip createComment. That makes the newly added synchronize trigger effectively inert for updated commits, because no fresh review request is posted after subsequent pushes.

Useful? React with 👍 / 👎.

}

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: '@codex Please review this PR. If you find no critical issues, reply with "LGTM". If you find critical issues, describe them clearly.',
repo: context.repo.repo,
issue_number: prNumber,
body: pingText,
});
9 changes: 9 additions & 0 deletions .github/workflows/report-intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
const exactMarker = `<!-- cbv-report-digest:${exactDigest} -->`;
const aggregateMarker = `<!-- cbv-aggregate-digest:${aggregateDigest} -->`;
const isUserReport = report.type === 'user_report';
const isSyntheticTestBreakage = !isUserReport && (
diagnostics.reason === 'test_breakage' ||
String(diagnostics.selectorVersion || '').startsWith('test-')
);
if (isSyntheticTestBreakage) {
core.info('Skip synthetic test breakage report to avoid noisy issues.');
return;
}

const baseLabels = [
isUserReport ? 'user-report' : 'auto-report',
];
Expand Down
23 changes: 20 additions & 3 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
chatgpt: {
turns: [
"article[data-testid^='conversation-turn-']",
"[data-testid='conversation-turn']",
'[data-message-author-role]',
'[data-message-id]',
],
turnRoleAttr: 'data-turn',
Expand Down Expand Up @@ -556,10 +558,25 @@ function makePathEntry(turn) {
}

function readChatGPTTurns() {
const turns = [...document.querySelectorAll('article[data-testid^="conversation-turn-"]')];
let turns = [...document.querySelectorAll('article[data-testid^="conversation-turn-"]')];

if (!turns.length) {
const fallbackSelectors = [
"[data-testid='conversation-turn']",
'[data-message-author-role]',
'main article',
];
const candidates = dedupeElements(fallbackSelectors.flatMap(sel => [...document.querySelectorAll(sel)]))
.filter(el => isReadableTurnCandidate(el, { minText: 2 }));
turns = candidates
.filter(el => !candidates.some(other => other !== el && other.contains(el)))
.sort((a, b) => rectTop(a) - rectTop(b));
}

return turns.map((turn, idx) => {
const role = turn.getAttribute('data-turn') === 'user' ? 'user' : 'assistant';
const msgDiv = turn.querySelector('[data-message-id]');
const roleAttr = turn.getAttribute('data-turn') || turn.getAttribute('data-message-author-role') || '';
const role = /^user$/i.test(roleAttr) ? 'user' : 'assistant';
Comment on lines +577 to +578
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve fallback turn role before defaulting to assistant

In readChatGPTTurns, fallback candidates can be container elements ([data-testid='conversation-turn'] or main article) where the author role is stored on a nested node, not on the container itself. Because roleAttr is read only from turn, missing attributes are forced to assistant, which misclassifies user turns and breaks path/tree accuracy on the layouts this fallback is intended to recover.

Useful? React with 👍 / 👎.

const msgDiv = turn.matches('[data-message-id]') ? turn : turn.querySelector('[data-message-id]');
const msgId = msgDiv?.getAttribute('data-message-id') || turn.getAttribute('data-turn-id') || null;
const nav = findChatGPTBranchNav(turn);
return {
Expand Down
4 changes: 3 additions & 1 deletion selectors.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"version": "0.3.0",
"version": "0.3.1",
"lastVerified": "2026-03-11",
"platforms": {
"chatgpt": {
"turns": [
"article[data-testid^='conversation-turn-']",
"[data-testid='conversation-turn']",
"[data-message-author-role]",
"[data-message-id]"
],
"turnRoleAttr": "data-turn",
Expand Down