Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style: clarify agent status and browser actions (#17242)

Arvin Xud5e8b7c863f5
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.md
index fb1be32959a..2d89c683e9e 100644
--- a/.agents/skills/agent-testing/SKILL.md
+++ b/.agents/skills/agent-testing/SKILL.md
@@ -369,6 +369,8 @@ At the end of Step 2, always send one user-facing Plan feedback before entering
Execute. Read and follow [references/plan.md](./references/plan.md). It requires:
- an overall environment verdict with concrete checks and evidence;
+- emoji-prefixed status markers in the verdict and every table row
+ (`✅ Ready`, `⚠️ Warning`, `❌ Blocked`, `⏳ Pending`);
- the proposed execution plan, cases, and expected evidence;
- every unresolved prerequisite, clearly assigned to Codex or the user;
- an explicit statement that nothing is needed from the user when that is true;
@@ -612,10 +614,12 @@ env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME
env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME lh login # only if not authed
```
-`verify ingest-report` reads `$DIR` and, in one call, creates a standalone
-verification session and uploads everything:
+`verify ingest-report` reads `$DIR` and, in one call, creates a new immutable
+verification run, attaches it to the subject acceptance, and uploads everything:
-- `result.json.plan[]` → the frozen check plan (what this round set out to verify)
+- `result.json.plan[]` → the frozen check plan (what this round set out to verify),
+ with a business-scenario `category` on every item; categories name requirements
+ or features, never execution surfaces such as Desktop / CLI / Backend
- `result.json.cases[]` → one check result each (verdict + key observation),
paired back to its plan item by `id`; a planned item with no case renders as
**未执行** instead of silently disappearing
@@ -635,11 +639,14 @@ inline screenshot/text evidence). On production that resolves to
`https://app.lobehub.com/verify/<verifyRunId>`. **Include that full production
link in the final chat reply** alongside the local report dir.
-#### Chaining rounds onto a subject's acceptance (optional)
+#### Every run belongs to a subject acceptance (mandatory)
-When the verification belongs to a business subject — a task, a topic, or a
-document — chain the session onto that subject's **acceptance aggregate** so
-every round lands on ONE decision page instead of scattered report entries:
+Every agent-testing run MUST be chained onto a task, topic, or document
+**acceptance aggregate**, so every round lands on one auditable decision page.
+When the harness runs inside a LobeHub topic, `ingest-report` automatically uses
+`LOBEHUB_TOPIC_ID` as `topic:<id>`; do not ask the user to supply it and do not
+omit the acceptance. An explicit `--subject` or `result.json.subject` overrides
+that default for task/document verification:
```bash
# SUBJECT is task:$TASK_ID, topic:$TOPIC_ID, or document:$DOC_ID
@@ -649,30 +656,24 @@ env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME
`--subject` accepts `task:<id> | topic:<id> | document:<id>` (or put
`"subject": "task:<id>"` / `{ "type", "id", "requirement" }` in `result.json`).
-The first ingest creates the acceptance; each **new session** (`--new` or a fresh
-`$DIR`) becomes the next round; re-ingesting a remembered dir updates its round
-in place. The user closes the loop on `/acceptance/<acceptanceId>` (also
+Outside a LobeHub topic, one of those explicit forms is required; publishing
+without a resolvable subject fails instead of creating an orphan verify report.
+The first ingest creates the acceptance and every ingest creates its next
+immutable round. The user closes the loop on `/acceptance/<acceptanceId>` (also
printed by `--open`) — accept / reject with a comment; inspect or decide from the
terminal via `lh verify acceptance view|accept|reject <id | type:id>`.
-#### Re-verifying the same case updates the report in place (don't spawn a new one)
+#### Every verification run is an immutable snapshot
-When you iterate on one change — fix → re-verify → fix again — **keep reusing the
-same report dir (`$DIR`)**. `ingest-report` records the session it created in a
-`.verify-run.json` sidecar inside `$DIR`, so re-ingesting the **same dir**
-**updates that session in place** (same `/verify/<id>` URL) instead of creating a
-new list entry every round. The update is a full replace: cases are overwritten
-by their stable `id`, each case's evidence is re-attached (old screenshots
-cleared, not stacked), and cases the new report dropped are pruned.
+One call to `ingest-report` creates one immutable `/verify/<id>` snapshot. Never
+overwrite, replace, prune, or re-ingest into an earlier run. A fix followed by
+re-verification MUST create another run on the same acceptance, preserving the
+earlier plan, results, evidence, and verdict exactly as observed at that time.
-So the rule for an iterative case: `report-init.sh` **once**, then re-run
-`ingest-report "$DIR"` after each fix — the report accretes value at one stable
-URL rather than flooding the list with near-duplicate runs. Only scaffold a fresh
-`$DIR` when you start verifying a genuinely different case.
-
-Escape hatches: `--new` forces a fresh session even if the dir already made one;
-`--run <verifyRunId>` targets an existing session explicitly (e.g. to update from
-a different machine/checkout where the sidecar is absent).
+Use a fresh report directory for every execution round. The acceptance page is
+the stable cross-round URL; individual `/verify/<id>` URLs are permanent
+historical records. There is no `--run` update path and no same-directory
+sidecar reuse in the agent-testing workflow.
Notes:
diff --git a/.agents/skills/agent-testing/references/common-mistakes.md b/.agents/skills/agent-testing/references/common-mistakes.md
index 7ce4aadddd4..cade14941f8 100644
--- a/.agents/skills/agent-testing/references/common-mistakes.md
+++ b/.agents/skills/agent-testing/references/common-mistakes.md
@@ -7,6 +7,46 @@
---
+## Case 20 — Publishing a replacement as a second Acceptance row and passing UI from text-only evidence
+
+**Wrong approach**: giving a refined check a new id without declaring `supersedes`, then marking
+visual UI checks passed from unit-test output or computed-style text without capturing and opening a
+screenshot of each claimed surface. A layout probe also accepted an absolutely positioned sidebar
+because it was right-aligned, without checking whether it covered the report.
+
+**Why it's wrong**: the Acceptance union intentionally does no fuzzy title matching; without an explicit
+replacement edge, both ids are valid independent requirements. Program output proves logic, not the
+rendered Markdown entity or the absence of visual overlap. A single CSS property is not the layout
+contract.
+
+**What it breaks**: superseded wording remains as a duplicate row, UI changes have no inspectable proof,
+and a green report can visibly cover its own content.
+
+**Correct approach**: when a new check replaces an older semantic requirement, put the prior stable id in
+the new plan item's `supersedes` array. Every user-visible UI case must require its own screenshot, open
+that image before passing, and assert the complete spatial outcome (right attachment plus zero overlap),
+not an isolated computed-style value. Never reuse one screenshot as evidence for unrelated UI cases.
+
+## Case 19 — Stopping after a fix without publishing the next Acceptance round
+
+**Wrong approach**: implementing and locally validating a user-requested second iteration, then
+ending the task without committing, pushing, or publishing a fresh immutable verify run to the
+existing Acceptance.
+
+**Why it's wrong**: an Acceptance is the cross-round audit trail. A local-only fix leaves the PR
+stale and makes the Acceptance claim that the previous round is still the latest result. Local
+tests are preparation, not the delivery.
+
+**What it breaks**: reviewers cannot inspect the updated code, the Acceptance timeline misses the
+iteration, and the user has to ask whether anything was actually shipped.
+
+**Correct approach**: after every requested iteration, complete the whole delivery loop unless the
+user explicitly says not to: validate the new state, commit and push the PR branch, create a fresh
+report directory, ingest exactly once as the next immutable run on the same subject Acceptance,
+verify the new round appears, then return both the commit and production links.
+
+---
+
## Case 18 — Treating a status badge as proof that the error message rendered
**Wrong approach**: marking an error-state UI case as passed because the platform page showed
diff --git a/.agents/skills/agent-testing/references/plan.md b/.agents/skills/agent-testing/references/plan.md
index 91259942268..d5b15313a58 100644
--- a/.agents/skills/agent-testing/references/plan.md
+++ b/.agents/skills/agent-testing/references/plan.md
@@ -5,10 +5,17 @@ Keep it concrete and compact: report observed state, not generic readiness claim
## Readiness verdicts
-- **Ready**: every prerequisite for the proposed run is verified.
-- **Ready with warnings**: execution can proceed; list non-blocking limitations and
+- **✅ Ready**: every prerequisite for the proposed run is verified.
+- **⚠️ Ready with warnings**: execution can proceed; list non-blocking limitations and
their effect on evidence or scope.
-- **Blocked**: execution cannot start until one or more prerequisites are resolved.
+- **❌ Blocked**: execution cannot start until one or more prerequisites are resolved.
+- **⏳ Pending**: an agent-owned check is actively being resolved and has not reached a
+ final readiness verdict yet.
+
+Always prefix the overall verdict and every Status cell with its emoji marker:
+`✅ Ready`, `⚠️ Warning`, `❌ Blocked`, or `⏳ Pending`. Do not use color words or
+bare status text without the marker; the table must remain scannable in clients
+that do not render semantic colors.
Fix safe environment mechanics yourself before reporting. Separate remaining
items by owner:
@@ -25,18 +32,18 @@ Never put a Codex-owned item under “Needed from you.” If none remain, write
## Template
```markdown
-Verification plan — Environment: <Ready | Ready with warnings | Blocked>
+Verification plan — Environment: <✅ Ready | ⚠️ Ready with warnings | ❌ Blocked>
Environment
-| Check | Status | Observed state |
-| ------------------ | ----------------------- | --------------------------------------------------- |
-| Workspace / branch | <Ready/Warning/Blocked> | <path, branch/worktree, relevant dirty-state note> |
-| Dependencies | <Ready/Warning/Blocked> | <root and selected standalone app status> |
-| Runtime / ports | <Ready/Warning/Blocked> | <resolved URLs/ports and ownership or availability> |
-| Required services | <Ready/Warning/Blocked> | <DB, Redis, QStash, dev server—only those in scope> |
-| Auth | <Ready/Warning/Blocked> | <selected surface and verified signed-in state> |
-| Evidence capture | <Ready/Warning/Blocked> | <CDP or OS capture readiness> |
+| Check | Status | Observed state |
+| ------------------ | ------------------------------------------- | --------------------------------------------------- |
+| Workspace / branch | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <path, branch/worktree, relevant dirty-state note> |
+| Dependencies | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <root and selected standalone app status> |
+| Runtime / ports | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <resolved URLs/ports and ownership or availability> |
+| Required services | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <DB, Redis, QStash, dev server—only those in scope> |
+| Auth | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <selected surface and verified signed-in state> |
+| Evidence capture | <✅ Ready/⚠️ Warning/❌ Blocked/⏳ Pending> | <CDP or OS capture readiness> |
Execution plan
@@ -61,6 +68,12 @@ Do not include irrelevant environment rows. Add a row when the run has another
hard prerequisite, such as a native bot app, gateway, fixture repository, or
specific external account.
+When a check refines or replaces a requirement from an earlier Acceptance round, keep the
+old stable id if it is the same assertion. If the semantic assertion needs a new id, declare
+the replacement explicitly with `supersedes: ['old-check-id']`; title similarity is never a
+merge signal. For every user-visible UI case, plan a dedicated screenshot or recording for
+that exact claim—program output may supplement it but cannot replace visual evidence.
+
## Confirmation behavior
After the feedback, use the runtime structured question tool
diff --git a/.agents/skills/agent-testing/references/report.md b/.agents/skills/agent-testing/references/report.md
index 74c380403b9..51fdeec49c7 100644
--- a/.agents/skills/agent-testing/references/report.md
+++ b/.agents/skills/agent-testing/references/report.md
@@ -144,9 +144,9 @@ table — those double up on the page. It carries only the non-duplicate narrati
lh verify ingest-report "$DIR" --source agent-testing --open --json
```
- This creates a standalone verification session and uploads the cases (as check
- results), each case's `evidence` files, and `report.md` (as the report body),
- then prints `/verify/<verifyRunId>` (→ `https://app.lobehub.com/verify/<id>`).
+ This creates a new immutable verification run, attaches it to the required
+ subject acceptance, uploads the cases, evidence, and report body, then prints
+ both `/verify/<verifyRunId>` and `/acceptance/<acceptanceId>`.
Include that full production link in the final reply alongside the local
report dir. See SKILL.md → Step 4 for why production (a localhost URL isn't
shareable and a local stub S3 fails file-evidence uploads), the production
@@ -230,6 +230,7 @@ missing; a blocked case is not a pass).
"branch": "feat/task-tree",
"cases": [
{
+ "category": "Task hierarchy",
"id": "1",
"name": "task tree returns nested children",
"surface": "cli",
@@ -278,9 +279,13 @@ missing; a blocked case is not a pass).
```
`plan[]` is the checks you committed to **before running them**, and it shares
-`id`s with `cases[]`. Only `id` and `title` are required. A plan item with no
-matching case renders as **未执行**: cutting coverage is allowed, hiding that you
-cut it is not.
+`id`s with `cases[]`. Every agent-testing plan item must carry a `category` that
+names its user-facing business scenario or requirement area (for example `Task
+hierarchy`, `Rate-limit recovery`, or `Browser actions`). It must not name a
+technical surface such as `Desktop`, `CLI`, or `Backend`: Acceptance groups are
+organized by what the user is accepting, while `surface` separately records
+where the check ran. A plan item with no matching case renders as **未执行**:
+cutting coverage is allowed, hiding that you cut it is not.
Two of its fields are a **closed vocabulary**, because the pipeline acts on them
— they are not labels:
@@ -299,9 +304,8 @@ check on the page next to the outcome.
A plan item may also carry a per-item `surface` (same closed set as the run-level
`surfaces` below; `electron` normalizes to `desktop`). It says which product
-surface THIS check ran on — the acceptance union view groups checks by it, so a
-mixed web+cli round stays legible. An unknown value is warned about and dropped,
-never stored.
+surface THIS check ran on. It is metadata, never an Acceptance grouping key. An
+unknown value is warned about and dropped, never stored.
`surfaces` is a **closed set** — `web` | `desktop` | `cli` | `mobile` | `bot` —
and names the product surface a check ran **on**. `electron` is accepted and
@@ -324,11 +328,15 @@ that isn't the branch's own.
polish, copy quality); omit it for purely binary runs. `verdict` is the single
word the user reads first: `pass`, `fail`, or `partial`.
-`subject` is optional and chains the session onto a business subject's
-**acceptance aggregate** (one decision page across repair rounds): either
+`subject` identifies the business subject whose **acceptance aggregate** owns
+this immutable run: either
`"subject": "task:<id>"` (`task` | `topic` | `document`) or
`{ "type": "task", "id": "task_…", "requirement": "one-sentence acceptance bar" }`.
-The `--subject` flag on `ingest-report` overrides this field.
+The `--subject` flag overrides this field. Inside a LobeHub conversation, both
+may be omitted because `ingest-report` defaults to
+`topic:$LOBEHUB_TOPIC_ID`; outside a topic, an explicit subject is mandatory.
+Every ingest creates a new immutable run. Never update a prior run after a fix;
+publish the re-verification as the next round on the same acceptance.
`interactionCost` is optional and run-level. For UI runs driven through
`agent-browser`, create `interaction-trace.jsonl` with
diff --git a/.agents/skills/agent-testing/scripts/electron-dev.sh b/.agents/skills/agent-testing/scripts/electron-dev.sh
index 17da0d29923..5b4abb581ef 100755
--- a/.agents/skills/agent-testing/scripts/electron-dev.sh
+++ b/.agents/skills/agent-testing/scripts/electron-dev.sh
@@ -503,7 +503,7 @@ do_start() {
local launch_cmd="
cd '$PROJECT_ROOT/apps/desktop'
- exec env $env_assignments npx electron-vite dev -- --remote-debugging-port=$CDP_PORT
+ exec env $env_assignments LOBE_DESKTOP_CDP_PORT=$CDP_PORT pnpm dev
"
if command -v setsid >/dev/null 2>&1; then
setsid bash -c "$launch_cmd" >>"$ELECTRON_LOG" 2>&1 </dev/null &
diff --git a/apps/cli/src/commands/verify.test.ts b/apps/cli/src/commands/verify.test.ts
index 1c1cdee4873..fb81394f7a0 100644
--- a/apps/cli/src/commands/verify.test.ts
+++ b/apps/cli/src/commands/verify.test.ts
@@ -11,6 +11,7 @@ import {
planFromResult,
registerVerifyCommand,
reportEvidence,
+ subjectFromEnv,
subjectFromResult,
surfacesFromResult,
} from './verify';
@@ -437,19 +438,16 @@ describe('planFromResult — plan item normalization', () => {
expect(planFromResult({ plan: [{ id: '1' }] })).toEqual([]);
});
- it('distinguishes "no plan field" from "an empty plan", so a re-ingest can CLEAR a stale one', () => {
- // Absent → undefined → `updateRun` omits it → whatever is stored stays.
+ it('distinguishes "no plan field" from an explicitly empty plan', () => {
+ // Absent → undefined: this snapshot did not declare a plan.
expect(planFromResult({})).toBeUndefined();
- // Present but empty → `[]` → the stored plan is overwritten with nothing.
- // Without this, re-ingesting a reused report dir whose plan was emptied
- // would leave the PREVIOUS round's plan attached, and every one of its items
- // would render as "not run" against a report that never planned them.
+ // Present but empty → `[]`: this snapshot explicitly planned no checks.
expect(planFromResult({ plan: [] })).toEqual([]);
});
});
-describe('verify ingest-report — decided rounds are immutable', () => {
+describe('verify ingest-report — every run is an immutable acceptance round', () => {
let consoleSpy: ReturnType<typeof vi.spyOn>;
let dir: string;
@@ -457,19 +455,22 @@ describe('verify ingest-report — decided rounds are immutable', () => {
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
mockGetTrpcClient.mockResolvedValue(mockTrpcClient);
const verify = mockTrpcClient.verify as Record<string, any>;
- verify.getRun = { query: vi.fn() };
verify.createRun = { mutate: vi.fn().mockResolvedValue({ id: 'run-new' }) };
verify.updateRun = { mutate: vi.fn() };
verify.upsertReport = { mutate: vi.fn().mockResolvedValue({}) };
+ mockTrpcClient.acceptance = {
+ attachRun: { mutate: vi.fn() },
+ ensure: { mutate: vi.fn().mockResolvedValue({ id: 'acceptance-1' }) },
+ };
dir = mkdtempSync(path.join(tmpdir(), 'lh-ingest-'));
writeFileSync(path.join(dir, 'result.json'), JSON.stringify({ cases: [] }));
- // The sidecar remembers the previous round's session.
- writeFileSync(path.join(dir, '.verify-run.json'), JSON.stringify({ verifyRunId: 'run-old' }));
+ process.env.LOBEHUB_TOPIC_ID = 'topic-1';
});
afterEach(() => {
consoleSpy.mockRestore();
+ delete process.env.LOBEHUB_TOPIC_ID;
rmSync(dir, { force: true, recursive: true });
});
@@ -480,30 +481,42 @@ describe('verify ingest-report — decided rounds are immutable', () => {
await program.parseAsync(['node', 'lh', 'verify', ...args]);
};
- it('starts a fresh round instead of updating a decided session in place', async () => {
+ it('creates a fresh run and binds it to the current topic acceptance', async () => {
const verify = mockTrpcClient.verify as Record<string, any>;
- verify.getRun.query.mockResolvedValue({
- id: 'run-old',
- metadata: null,
- userDecision: 'reject',
- });
await run(['ingest-report', dir, '--json']);
- // The rejected round is history: no in-place update, a new session instead.
expect(verify.updateRun.mutate).not.toHaveBeenCalled();
expect(verify.createRun.mutate).toHaveBeenCalled();
+ expect(mockTrpcClient.acceptance.ensure.mutate).toHaveBeenCalledWith({
+ requirement: undefined,
+ subjectId: 'topic-1',
+ subjectType: 'topic',
+ });
+ expect(mockTrpcClient.acceptance.attachRun.mutate).toHaveBeenCalledWith({
+ acceptanceId: 'acceptance-1',
+ verifyRunId: 'run-new',
+ });
});
- it('still updates an undecided remembered session in place', async () => {
+ it('creates another run when the same report directory is ingested again', async () => {
const verify = mockTrpcClient.verify as Record<string, any>;
- verify.getRun.query.mockResolvedValue({ id: 'run-old', metadata: null, userDecision: null });
- verify.listResultsByRun = { query: vi.fn().mockResolvedValue([]) };
+ verify.createRun.mutate
+ .mockResolvedValueOnce({ id: 'run-first' })
+ .mockResolvedValueOnce({ id: 'run-second' });
await run(['ingest-report', dir, '--json']);
+ await run(['ingest-report', dir, '--json']);
- expect(verify.updateRun.mutate).toHaveBeenCalled();
- expect(verify.createRun.mutate).not.toHaveBeenCalled();
+ expect(verify.createRun.mutate).toHaveBeenCalledTimes(2);
+ expect(mockTrpcClient.acceptance.attachRun.mutate).toHaveBeenNthCalledWith(1, {
+ acceptanceId: 'acceptance-1',
+ verifyRunId: 'run-first',
+ });
+ expect(mockTrpcClient.acceptance.attachRun.mutate).toHaveBeenNthCalledWith(2, {
+ acceptanceId: 'acceptance-1',
+ verifyRunId: 'run-second',
+ });
});
});
@@ -596,3 +609,23 @@ describe('originFromEnv — in-app provenance', () => {
expect(originFromEnv()).toBeUndefined();
});
});
+
+describe('subjectFromEnv — default topic acceptance', () => {
+ const saved = { ...process.env };
+
+ afterEach(() => {
+ process.env = { ...saved };
+ });
+
+ it('binds an in-app run to its authoring topic', () => {
+ process.env.LOBEHUB_TOPIC_ID = 'tpc_1';
+
+ expect(subjectFromEnv()).toEqual({ subjectId: 'tpc_1', subjectType: 'topic' });
+ });
+
+ it('requires an explicit subject outside a topic', () => {
+ delete process.env.LOBEHUB_TOPIC_ID;
+
+ expect(subjectFromEnv()).toBeNull();
+ });
+});
diff --git a/apps/cli/src/commands/verify.ts b/apps/cli/src/commands/verify.ts
index f176e1981a1..4ebcd6e669e 100644
--- a/apps/cli/src/commands/verify.ts
+++ b/apps/cli/src/commands/verify.ts
@@ -279,12 +279,9 @@ function assertPlanEnum<T extends string>(
* no enum can carry. Everything else the frozen {@link VerifyCheckItem} needs is
* filled in here, so an author writes only `{ id, title }` plus what they mean.
*
- * Returns `undefined` only when the report declares no `plan` field at all —
- * "leave whatever is stored alone". A `plan` that IS present but empty returns
- * `[]`, which CLEARS the stored one. The distinction matters on a re-ingest of a
- * reused report dir: a previous round's plan would otherwise stay attached, and
- * every one of its items would render as "not run" against a report that never
- * planned them.
+ * Returns `undefined` when the report declares no `plan` field. A `plan` that is
+ * present but empty returns `[]`, recording an explicitly empty plan in this
+ * immutable snapshot.
*/
export function planFromResult(result: Record<string, unknown>) {
if (!Array.isArray(result.plan)) return undefined;
@@ -392,9 +389,7 @@ function metadataForReport(
origin?: VerifyRunOrigin,
): Record<string, unknown> | undefined {
const hasInteractionCost = Object.prototype.hasOwnProperty.call(result, 'interactionCost');
- // Nothing to write is not the same as writing an empty bag — leave the run's
- // metadata untouched so a re-ingest from a plain terminal can't wipe the
- // origin a previous in-app round recorded.
+ // Nothing to write is not the same as writing an empty metadata bag.
if (!hasInteractionCost && !origin) return undefined;
const metadata = { ...objectValue(existingMetadata) };
@@ -455,32 +450,10 @@ export function subjectFromResult(result: Record<string, unknown>): {
return ref ? { ref, requirement: firstString(value.requirement) } : null;
}
-/**
- * The report dir remembers which verification session it created, so
- * re-verifying the same case updates one evolving `/verify/<id>` in place
- * instead of spawning a fresh list entry every round. Kept in a sidecar (not
- * result.json, which the harness regenerates each round) so it survives a
- * rewrite of the report body.
- */
-const RUN_SIDECAR = '.verify-run.json';
-
-function readSidecarRunId(dir: string): string | undefined {
- const p = path.join(dir, RUN_SIDECAR);
- if (!existsSync(p)) return undefined;
- try {
- const parsed = JSON.parse(readFileSync(p, 'utf8'));
- return typeof parsed?.verifyRunId === 'string' ? parsed.verifyRunId : undefined;
- } catch {
- return undefined;
- }
-}
-
-function writeSidecarRunId(dir: string, verifyRunId: string): void {
- try {
- writeFileSync(path.join(dir, RUN_SIDECAR), `${JSON.stringify({ verifyRunId }, null, 2)}\n`);
- } catch {
- // Best-effort: a read-only dir just means the next run creates a new session.
- }
+/** Default acceptance subject for a report authored inside a LobeHub topic. */
+export function subjectFromEnv(): AcceptanceSubjectRef | null {
+ const topicId = firstString(process.env.LOBEHUB_TOPIC_ID);
+ return topicId ? { subjectId: topicId, subjectType: 'topic' } : null;
}
// ── Command Registration ───────────────────────────────────
@@ -1350,11 +1323,9 @@ export function registerVerifyCommand(program: Command) {
.option('--operation <id>', 'Link the session to an existing Agent Run')
.option('--title <title>', 'Override the session title')
.option('--goal <goal>', 'The goal/task being verified')
- .option('--run <verifyRunId>', 'Update an existing session in place instead of creating one')
- .option('--new', 'Force a fresh session even if this report dir already created one')
.option(
'--subject <type:id>',
- "Chain this session onto the subject's acceptance as its next round (task:<id> | topic:<id> | document:<id>)",
+ 'Override the required acceptance subject (defaults to the current LOBEHUB_TOPIC_ID)',
)
.option(
'--requirement <text>',
@@ -1368,11 +1339,9 @@ export function registerVerifyCommand(program: Command) {
options: {
goal?: string;
json?: boolean | string;
- new?: boolean;
open?: boolean;
operation?: string;
requirement?: string;
- run?: string;
source?: string;
subject?: string;
title?: string;
@@ -1423,9 +1392,8 @@ export function registerVerifyCommand(program: Command) {
// the coding scope header. Overridable via result.json `scenario`.
const scenario = result.scenario === 'coding' ? 'coding' : ('coding' as const);
- // The acceptance subject this report belongs to: an explicit --subject
- // wins; otherwise result.json's `subject` field. Malformed explicit input
- // is a user error; a malformed result field is reported and skipped.
+ // Every agent-testing report belongs to an acceptance. Explicit CLI input
+ // wins, then result.json, then the authoring topic echoed by the runtime.
let subject = subjectFromResult(result);
if (options.subject) {
const ref = parseSubjectRef(options.subject);
@@ -1437,9 +1405,17 @@ export function registerVerifyCommand(program: Command) {
}
subject = { ref, requirement: subject?.requirement };
} else if (result.subject && !subject) {
- log.warn(
- 'result.json `subject` is malformed — ignoring it (expected "type:id" or {type,id})',
+ log.error('result.json `subject` is malformed (expected "type:id" or {type,id})');
+ process.exit(1);
+ } else if (!subject) {
+ const ref = subjectFromEnv();
+ if (ref) subject = { ref };
+ }
+ if (!subject) {
+ log.error(
+ 'Acceptance subject is required: run inside a LobeHub topic or pass --subject task:<id> | topic:<id> | document:<id>',
);
+ process.exit(1);
}
const requirement = options.requirement ?? subject?.requirement;
@@ -1452,88 +1428,33 @@ export function registerVerifyCommand(program: Command) {
const origin = originFromEnv();
const newRunMetadata = metadataForReport(result, undefined, origin);
- // Resolve the target session. Reuse the one this report dir already
- // created (recorded in the sidecar) so re-verifying the same case
- // updates one evolving report in place rather than adding a list entry
- // per round. `--run` targets a session explicitly; `--new` forces a
- // fresh one; `--operation` links a fresh session to an Agent Run.
- const rememberedRunId = options.new ? undefined : (options.run ?? readSidecarRunId(dir));
- let runId!: string;
- let reused = false;
- if (rememberedRunId) {
- const existing = await client.verify.getRun.query({ verifyRunId: rememberedRunId });
- if (existing && existing.userDecision) {
- // The remembered round has already been judged (e.g. rejected on the
- // acceptance page). A decided round is immutable history — updating
- // it in place would leave the aggregate stuck on the old decision.
- // Fall through to a fresh session, which chains as the NEXT round
- // and re-opens the acceptance.
- if (options.run) {
- log.error(
- `Session ${options.run} already carries a user decision (${existing.userDecision}) — drop --run so a new round is created`,
- );
- process.exit(1);
- }
- log.info(
- `Recorded session was already decided (${existing.userDecision}) — starting a new round`,
- );
- } else if (existing) {
- reused = true;
- runId = existing.id;
- const metadata = metadataForReport(result, existing.metadata, origin);
- // 1a. Refresh the scope header / plan / title / goal in place.
- await client.verify.updateRun.mutate({
- value: { context, goal, metadata, plan, scenario, title },
- verifyRunId: runId,
- });
- } else if (options.run) {
- // An explicit --run that doesn't resolve is a user error, not a
- // silent fall-through to a stray new session.
- log.error(`Verification session not found: ${options.run}`);
- process.exit(1);
- } else {
- // The remembered session was deleted — drop the stale pointer and
- // create a fresh one below.
- log.warn(`Recorded session ${rememberedRunId} no longer exists — creating a new one`);
- }
- }
-
- // 1b. Create the verification session when not updating one in place.
- if (!reused) {
- const run = await client.verify.createRun.mutate({
- context,
- goal,
- metadata: newRunMetadata,
- operationId: options.operation,
- plan,
- scenario,
- source: options.source as any,
- title,
- });
- runId = run.id;
- }
+ // Every ingest is a new immutable verification snapshot. A repair or
+ // re-verification is represented by another run on the same acceptance.
+ const run = await client.verify.createRun.mutate({
+ context,
+ goal,
+ metadata: newRunMetadata,
+ operationId: options.operation,
+ plan,
+ scenario,
+ source: options.source as any,
+ title,
+ });
+ const runId = run.id;
// 1c. Chain the session onto its subject's acceptance as the next round
// BEFORE the report lands, so the report-time status rollup already
- // sees the aggregate. Idempotent: a reused session keeps its round.
- let acceptanceId: string | undefined;
- if (subject) {
- const acceptance = await client.acceptance.ensure.mutate({
- requirement,
- subjectId: subject.ref.subjectId,
- subjectType: subject.ref.subjectType,
- });
- acceptanceId = acceptance.id;
- await client.acceptance.attachRun.mutate({
- acceptanceId: acceptance.id,
- verifyRunId: runId,
- });
- }
+ // sees the aggregate.
+ const acceptance = await client.acceptance.ensure.mutate({
+ requirement,
+ subjectId: subject.ref.subjectId,
+ subjectType: subject.ref.subjectType,
+ });
+ const acceptanceId = acceptance.id;
+ await client.acceptance.attachRun.mutate({ acceptanceId, verifyRunId: runId });
// 2. Ingest each case as a check result + its evidence. `checkItemId` is
- // the stable upsert key, so a re-ingest overwrites the matching case
- // rather than duplicating it. Track the ids we touch to prune dropped
- // cases afterwards, keeping a re-run a full replace.
+ // the stable key within this immutable run.
const seenCheckItemIds = new Set<string>();
let evidenceCount = 0;
let inlined = 0;
@@ -1549,10 +1470,8 @@ export function registerVerifyCommand(program: Command) {
required: c.required ?? true,
// The case's key observation is recorded as Toulmin evidence; a real
// remediation hint (if the report provides one) goes to `suggestion`.
- // Absent → explicit `null`, not `undefined`: ingest-report is a full
- // replace, so a case that dropped its observation/suggestion this
- // round must CLEAR the prior value on a reused run (undefined would be
- // skipped by the conflict UPDATE and leave stale text on the row).
+ // Absent → explicit `null`, so this immutable snapshot records the
+ // absence instead of relying on upsert defaults.
suggestion: typeof c.suggestion === 'string' ? c.suggestion : null,
toulmin: typeof observation === 'string' ? { evidence: observation } : null,
verdict,
@@ -1560,17 +1479,6 @@ export function registerVerifyCommand(program: Command) {
verifyRunId: runId,
});
- // On an in-place update, clear the case's prior evidence before
- // re-attaching so screenshots are replaced, not stacked round on round.
- if (reused) {
- const prior = await client.verify.listEvidence.query({
- checkResultId: checkResult.id,
- });
- for (const ev of prior) {
- await client.verify.deleteEvidence.mutate({ id: ev.id });
- }
- }
-
for (const evidenceInput of reportEvidence(c.evidence)) {
const rel = evidenceInput.path;
const abs = path.isAbsolute(rel) ? rel : path.join(dir, rel);
@@ -1632,26 +1540,6 @@ export function registerVerifyCommand(program: Command) {
verifyRunId: runId,
});
- // 4. Prune cases the report no longer has (only when updating in place —
- // a fresh session has nothing to prune). Keeps a re-run a full
- // replace: dropped checks and their evidence disappear.
- let pruned = 0;
- if (reused) {
- const existingResults = await client.verify.listResultsByRun.query({
- verifyRunId: runId,
- });
- for (const r of existingResults) {
- if (!seenCheckItemIds.has(r.checkItemId)) {
- await client.verify.deleteResult.mutate({ id: r.id });
- pruned += 1;
- }
- }
- }
-
- // 5. Remember this session on the report dir so the next ingest of the
- // same dir updates it in place instead of creating a new one.
- writeSidecarRunId(dir, runId);
-
// A case with no matching plan item means the run checked something it
// never planned — worth saying out loud, but not a failure. Only
// meaningful against a plan that actually names something: with no plan
@@ -1669,10 +1557,8 @@ export function registerVerifyCommand(program: Command) {
inlined,
origin,
planItems: plan?.length ?? 0,
- pruned,
pullRequest,
- reused,
- subject: subject?.ref,
+ subject: subject.ref,
unplanned,
verifyRunId: runId,
},
@@ -1681,11 +1567,9 @@ export function registerVerifyCommand(program: Command) {
return;
}
- const verb = reused ? 'Updated' : 'Ingested';
console.log(
- `${pc.green('✓')} ${verb} ${pc.bold(String(cases.length))} case(s), ${pc.bold(String(evidenceCount))} evidence artifact(s)` +
- `${inlined > 0 ? `, ${pc.bold(String(inlined))} inline` : ''}` +
- `${pruned > 0 ? `, pruned ${pc.bold(String(pruned))} stale case(s)` : ''}`,
+ `${pc.green('✓')} Ingested ${pc.bold(String(cases.length))} case(s), ${pc.bold(String(evidenceCount))} evidence artifact(s)` +
+ `${inlined > 0 ? `, ${pc.bold(String(inlined))} inline` : ''}`,
);
if (plan?.length) {
const unexecuted = plan.filter((item) => !seenCheckItemIds.has(item.id));
@@ -1694,25 +1578,16 @@ export function registerVerifyCommand(program: Command) {
`${unexecuted.length > 0 ? pc.yellow(` — ${unexecuted.length} planned but not executed`) : ''}` +
`${unplanned.length > 0 ? pc.dim(` — ${unplanned.length} unplanned case(s)`) : ''}`,
);
- } else if (plan && reused) {
- // The report dropped its plan this round; say that the stored one went
- // with it, rather than leaving the user to wonder where it went.
- console.log(`${pc.bold('plan')}: ${pc.dim('none — cleared the previously stored plan')}`);
}
if (pullRequest?.url) console.log(`${pc.bold('pr')}: ${pullRequest.url}`);
if (origin?.topicId) console.log(`${pc.bold('origin topic')}: ${origin.topicId}`);
+ console.log(`${pc.bold('verifyRunId')}: ${runId} ${pc.dim('(immutable snapshot)')}`);
console.log(
- `${pc.bold('verifyRunId')}: ${runId}${reused ? pc.dim(' (updated in place)') : ''}`,
+ `${pc.bold('acceptance')}: ${acceptanceId} ${pc.dim(`(${subject.ref.subjectType}:${subject.ref.subjectId})`)}`,
);
- if (acceptanceId) {
- console.log(
- `${pc.bold('acceptance')}: ${acceptanceId} ${pc.dim(`(${subject!.ref.subjectType}:${subject!.ref.subjectId})`)}`,
- );
- }
if (options.open) {
console.log(`${pc.bold('open')}: /verify/${runId}`);
- if (acceptanceId)
- console.log(`${pc.bold('open acceptance')}: /acceptance/${acceptanceId}`);
+ console.log(`${pc.bold('open acceptance')}: /acceptance/${acceptanceId}`);
}
},
);
diff --git a/apps/desktop/scripts/dev.mjs b/apps/desktop/scripts/dev.mjs
index 31953316391..1c16d5163c5 100644
--- a/apps/desktop/scripts/dev.mjs
+++ b/apps/desktop/scripts/dev.mjs
@@ -10,6 +10,7 @@ const require = createRequire(path.join(desktopRoot, 'package.json'));
const electronBin = require('electron');
const VITE_PORT = Number(process.env.LOBE_DESKTOP_VITE_PORT) || 5173;
+const CDP_PORT = Number(process.env.LOBE_DESKTOP_CDP_PORT);
const MAIN_BUNDLE = path.join(desktopRoot, 'dist/main/index.js');
const PRELOAD_BUNDLE = path.join(desktopRoot, 'dist/preload/index.js');
@@ -44,7 +45,12 @@ process.on('SIGINT', () => shutdown(0));
process.on('SIGTERM', () => shutdown(0));
function startElectron() {
- electron = spawn(electronBin, ['.'], {
+ const args = ['.'];
+ if (Number.isInteger(CDP_PORT) && CDP_PORT > 0) {
+ args.push(`--remote-debugging-port=${CDP_PORT}`);
+ }
+
+ electron = spawn(electronBin, args, {
cwd: desktopRoot,
env: {
...process.env,
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index ea6009414d3..2d513aecc41 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -137,6 +137,8 @@
"cliRateLimitGuide.schedule.runNow": "Run now",
"cliRateLimitGuide.schedule.scheduledAfterReset": "Scheduled. This run will continue automatically once the limit resets.",
"cliRateLimitGuide.schedule.scheduledForApprox": "Scheduled. This run will continue automatically in about {{duration}}.",
+ "cliRateLimitGuide.schedule.titleAfterReset": "Scheduled {{name}} to continue after the limit resets",
+ "cliRateLimitGuide.schedule.titleForApprox": "Scheduled {{name}} to continue in about {{duration}}",
"cliRateLimitGuide.title": "{{name}} is temporarily unavailable",
"codexInstallGuide.actions.openDocs": "Open Install Guide",
"codexInstallGuide.actions.openSystemTools": "Open System Tools",
@@ -458,6 +460,10 @@
"inputQueue.sendNow": "Send now (interrupts current run)",
"intentUnderstanding.title": "Understanding your intent...",
"internalLink.agent.open": "Open agent",
+ "internalLink.preview.acceptance": "Acceptance",
+ "internalLink.preview.acceptanceCounts": "{{passed}}/{{total}} passed · {{exceptions}} exceptions",
+ "internalLink.preview.acceptanceRounds_one": "{{count}} verification round",
+ "internalLink.preview.acceptanceRounds_other": "{{count}} verification rounds",
"internalLink.preview.agent": "Agent",
"internalLink.preview.document": "Page",
"internalLink.preview.task": "Task",
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 0ff887b7581..acd2e00ea77 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -1,6 +1,17 @@
{
"arguments.moreParams": "{{count}} params in total",
"arguments.title": "Arguments",
+ "builtins.codex.agentBrowser.click": "Clicked element",
+ "builtins.codex.agentBrowser.eval": "Evaluated page",
+ "builtins.codex.agentBrowser.fill": "Filled input",
+ "builtins.codex.agentBrowser.focus": "Focused element",
+ "builtins.codex.agentBrowser.get": "Read browser state",
+ "builtins.codex.agentBrowser.navigate": "Opened page",
+ "builtins.codex.agentBrowser.press": "Pressed key",
+ "builtins.codex.agentBrowser.screenshot": "Captured screenshot",
+ "builtins.codex.agentBrowser.snapshot": "Read page elements",
+ "builtins.codex.agentBrowser.type": "Typed text",
+ "builtins.codex.agentBrowser.wait": "Waited for page",
"builtins.codex.apiName.collab_tool_call": "Coordinate subagents",
"builtins.codex.apiName.command_execution": "Run command",
"builtins.codex.apiName.file_change": "Edit files",
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index d01a75c905e..a01d8eac597 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -45,6 +45,7 @@
"acceptance.group.expandAll": "Expand groups",
"acceptance.group.expandItems": "Expand checks in this group",
"acceptance.group.passRatio": "{{passed}}/{{total}} passed",
+ "acceptance.group.uncategorized": "Other requirements",
"acceptance.history.jump": "Round {{round}} — click to locate it in the ledger",
"acceptance.latestSummary": "Latest report summary",
"acceptance.ledger.collapse": "Collapse the round ledger",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index f71d838c5f1..eaa203e74e5 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -137,6 +137,8 @@
"cliRateLimitGuide.schedule.runNow": "立即运行",
"cliRateLimitGuide.schedule.scheduledAfterReset": "已安排,限额重置后将自动继续本次运行。",
"cliRateLimitGuide.schedule.scheduledForApprox": "已安排,约 {{duration}} 后将自动继续本次运行。",
+ "cliRateLimitGuide.schedule.titleAfterReset": "已安排 {{name}} 在限额重置后继续运行",
+ "cliRateLimitGuide.schedule.titleForApprox": "已安排 {{name}} 在约 {{duration}} 后继续运行",
"cliRateLimitGuide.title": "{{name}} 暂时不可用",
"codexInstallGuide.actions.openDocs": "打开安装指南",
"codexInstallGuide.actions.openSystemTools": "打开系统工具",
@@ -458,6 +460,10 @@
"inputQueue.sendNow": "立即发送(中断当前运行)",
"intentUnderstanding.title": "正在理解你的意图…",
"internalLink.agent.open": "打开助理",
+ "internalLink.preview.acceptance": "验收",
+ "internalLink.preview.acceptanceCounts": "{{passed}}/{{total}} 通过 · {{exceptions}} 个例外",
+ "internalLink.preview.acceptanceRounds_one": "{{count}} 轮验证",
+ "internalLink.preview.acceptanceRounds_other": "{{count}} 轮验证",
"internalLink.preview.agent": "Agent",
"internalLink.preview.document": "页面",
"internalLink.preview.task": "任务",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 9e988256caf..40a3f169f18 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -1,6 +1,17 @@
{
"arguments.moreParams": "等 {{count}} 个参数",
"arguments.title": "参数列表",
+ "builtins.codex.agentBrowser.click": "点击元素",
+ "builtins.codex.agentBrowser.eval": "检查页面状态",
+ "builtins.codex.agentBrowser.fill": "填写输入框",
+ "builtins.codex.agentBrowser.focus": "聚焦元素",
+ "builtins.codex.agentBrowser.get": "读取浏览器状态",
+ "builtins.codex.agentBrowser.navigate": "打开页面",
+ "builtins.codex.agentBrowser.press": "按下按键",
+ "builtins.codex.agentBrowser.screenshot": "截取页面",
+ "builtins.codex.agentBrowser.snapshot": "读取页面元素",
+ "builtins.codex.agentBrowser.type": "输入文本",
+ "builtins.codex.agentBrowser.wait": "等待页面",
"builtins.codex.apiName.collab_tool_call": "协调子代理",
"builtins.codex.apiName.command_execution": "运行命令",
"builtins.codex.apiName.file_change": "编辑文件",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index c48a77a8ff4..52285092c57 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -45,6 +45,7 @@
"acceptance.group.expandAll": "展开分组",
"acceptance.group.expandItems": "展开本组检查项",
"acceptance.group.passRatio": "{{passed}}/{{total}} 通过",
+ "acceptance.group.uncategorized": "其他需求",
"acceptance.history.jump": "第 {{round}} 轮——点击在轮次审计中定位",
"acceptance.latestSummary": "最新报告摘要",
"acceptance.ledger.collapse": "收起轮次审计",
diff --git a/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx b/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
index c9d945fb53f..da696c8dbee 100644
--- a/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
+++ b/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
@@ -8,11 +8,24 @@ import {
} from '@lobechat/shared-tool-ui/inspectors';
import type { RunCommandState } from '@lobechat/tool-runtime';
import type { BuiltinInspectorProps } from '@lobechat/types';
+import {
+ Camera,
+ CodeXml,
+ Eye,
+ Globe,
+ Keyboard,
+ MousePointerClick,
+ ScanText,
+ TextCursorInput,
+ Timer,
+} from 'lucide-react';
import type { ComponentType } from 'react';
import { memo } from 'react';
import {
+ type AgentBrowserAction,
type CodexCommandProgram,
+ getAgentBrowserCommandDisplay,
getCodexCommandProgram,
getCodexGrepCommandDisplay,
getCodexReadFileCommandDisplay,
@@ -23,6 +36,23 @@ const GREP_KEY = 'builtins.codex.commandExecution.grep';
const GREP_NO_RESULTS_KEY = 'builtins.codex.commandExecution.noResults';
const READ_FILE_KEY = 'builtins.codex.commandExecution.readFile';
+const AGENT_BROWSER_DISPLAY: Record<
+ AgentBrowserAction,
+ { icon: ComponentType<{ className?: string; size?: number }>; translationKey: string }
+> = {
+ click: { icon: MousePointerClick, translationKey: 'builtins.codex.agentBrowser.click' },
+ eval: { icon: CodeXml, translationKey: 'builtins.codex.agentBrowser.eval' },
+ fill: { icon: TextCursorInput, translationKey: 'builtins.codex.agentBrowser.fill' },
+ focus: { icon: Eye, translationKey: 'builtins.codex.agentBrowser.focus' },
+ get: { icon: ScanText, translationKey: 'builtins.codex.agentBrowser.get' },
+ navigate: { icon: Globe, translationKey: 'builtins.codex.agentBrowser.navigate' },
+ press: { icon: Keyboard, translationKey: 'builtins.codex.agentBrowser.press' },
+ screenshot: { icon: Camera, translationKey: 'builtins.codex.agentBrowser.screenshot' },
+ snapshot: { icon: ScanText, translationKey: 'builtins.codex.agentBrowser.snapshot' },
+ type: { icon: TextCursorInput, translationKey: 'builtins.codex.agentBrowser.type' },
+ wait: { icon: Timer, translationKey: 'builtins.codex.agentBrowser.wait' },
+};
+
/** Dedicated label + brand icon per program family. */
const PROGRAM_DISPLAY: Record<
CodexCommandProgram,
@@ -125,6 +155,24 @@ const CommandExecutionInspector = memo<
);
}
+ const agentBrowserDisplay =
+ getAgentBrowserCommandDisplay(args?.command) ??
+ getAgentBrowserCommandDisplay(partialArgs?.command);
+ if (agentBrowserDisplay) {
+ const { icon, translationKey } = AGENT_BROWSER_DISPLAY[agentBrowserDisplay.action];
+ const description =
+ agentBrowserDisplay.action === 'eval' ? undefined : agentBrowserDisplay.value;
+ return (
+ <RunCommandInspector
+ {...props}
+ args={{ ...args, command: '', description }}
+ icon={icon}
+ partialArgs={undefined}
+ translationKey={translationKey}
+ />
+ );
+ }
+
const program =
getCodexCommandProgram(args?.command) ?? getCodexCommandProgram(partialArgs?.command);
if (program) {
diff --git a/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts b/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
index e9272975868..5d5c9143d76 100644
--- a/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
+++ b/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import {
+ getAgentBrowserCommandDisplay,
getCodexCommandProgram,
getCodexGrepCommandDisplay,
getCodexReadFileCommandDisplay,
@@ -144,3 +145,44 @@ describe('getCodexCommandProgram', () => {
expect(getCodexCommandProgram(undefined)).toBeUndefined();
});
});
+
+describe('getAgentBrowserCommandDisplay', () => {
+ it('extracts the action while ignoring session and CDP plumbing', () => {
+ expect(
+ getAgentBrowserCommandDisplay(
+ 'agent-browser --session s9261 --cdp 9261 click @e160 && agent-browser --session s9261 snapshot -i',
+ ),
+ ).toEqual({ action: 'click', value: '@e160' });
+ expect(
+ getAgentBrowserCommandDisplay('agent-browser --session s9261 --cdp 9261 snapshot -i -C'),
+ ).toEqual({ action: 'snapshot', value: undefined });
+ });
+
+ it('extracts useful values without exposing evaluated JavaScript', () => {
+ expect(getAgentBrowserCommandDisplay('agent-browser open https://example.com/docs')).toEqual({
+ action: 'navigate',
+ value: 'example.com/docs',
+ });
+ expect(getAgentBrowserCommandDisplay('agent-browser eval "document.title"')).toEqual({
+ action: 'eval',
+ value: undefined,
+ });
+ expect(getAgentBrowserCommandDisplay('agent-browser screenshot ./proof/page.png')).toEqual({
+ action: 'screenshot',
+ value: './proof/page.png',
+ });
+ });
+
+ it('supports env assignments and absolute executables', () => {
+ expect(
+ getAgentBrowserCommandDisplay(
+ 'AB_TARGET="--session s9261 --cdp 9261" /usr/local/bin/agent-browser focus "[aria-label=Add]"',
+ ),
+ ).toEqual({ action: 'focus', value: '[aria-label=Add]' });
+ });
+
+ it('returns undefined for unrelated or unsupported commands', () => {
+ expect(getAgentBrowserCommandDisplay('curl http://localhost')).toBeUndefined();
+ expect(getAgentBrowserCommandDisplay('agent-browser close --all')).toBeUndefined();
+ });
+});
diff --git a/packages/builtin-tools/src/codex/commandExecutionUtils.ts b/packages/builtin-tools/src/codex/commandExecutionUtils.ts
index b802e9e2c64..1761f696922 100644
--- a/packages/builtin-tools/src/codex/commandExecutionUtils.ts
+++ b/packages/builtin-tools/src/codex/commandExecutionUtils.ts
@@ -285,6 +285,107 @@ export const getCodexGrepCommandDisplay = (
/** Program families we give a dedicated label + brand icon instead of the generic terminal chip. */
export type CodexCommandProgram = 'agent-browser' | 'git' | 'node' | 'python';
+export type AgentBrowserAction =
+ | 'click'
+ | 'eval'
+ | 'fill'
+ | 'focus'
+ | 'get'
+ | 'navigate'
+ | 'press'
+ | 'screenshot'
+ | 'snapshot'
+ | 'type'
+ | 'wait';
+
+export interface AgentBrowserCommandDisplay {
+ action: AgentBrowserAction;
+ value?: string;
+}
+
+const AGENT_BROWSER_GLOBAL_OPTIONS_WITH_VALUE = new Set([
+ '--cdp',
+ '--headers',
+ '--profile',
+ '--session',
+]);
+
+const AGENT_BROWSER_ACTIONS = new Set<AgentBrowserAction>([
+ 'click',
+ 'eval',
+ 'fill',
+ 'focus',
+ 'get',
+ 'navigate',
+ 'press',
+ 'screenshot',
+ 'snapshot',
+ 'type',
+ 'wait',
+]);
+
+/** Reduce agent-browser CLI plumbing to the user-visible browser action. */
+export const getAgentBrowserCommandDisplay = (
+ command?: string,
+): AgentBrowserCommandDisplay | undefined => {
+ const displayCommand = stripShellWrapper(command);
+ if (!displayCommand) return;
+
+ const tokens = tokenizeShellLike(displayCommand);
+ if (!tokens) return;
+
+ let index = 0;
+ while (index < tokens.length && ENV_ASSIGNMENT_PATTERN.test(tokens[index] || '')) index += 1;
+
+ const executable = tokens[index]?.split('/').at(-1);
+ if (executable !== 'agent-browser') return;
+ index += 1;
+
+ while (index < tokens.length) {
+ const token = tokens[index];
+ if (!token) return;
+ if (AGENT_BROWSER_GLOBAL_OPTIONS_WITH_VALUE.has(token)) {
+ index += 2;
+ continue;
+ }
+ if (token.startsWith('-')) {
+ index += 1;
+ continue;
+ }
+ break;
+ }
+
+ const rawAction = tokens[index];
+ const action = rawAction === 'open' || rawAction === 'goto' ? 'navigate' : rawAction;
+ if (!AGENT_BROWSER_ACTIONS.has(action as AgentBrowserAction)) return;
+
+ const args = tokens.slice(index + 1);
+ const firstArgument = args.find((token) => !token.startsWith('-') && token !== '&&');
+ const value = (() => {
+ switch (action) {
+ case 'snapshot': {
+ return;
+ }
+ case 'eval': {
+ // JavaScript is an implementation detail, not a useful user-facing
+ // summary. Keep the semantic action while hiding the executed source.
+ return;
+ }
+ case 'navigate': {
+ return firstArgument?.replace(/^https?:\/\//i, '');
+ }
+ case 'get': {
+ return args[0] === 'url' || args[0] === 'title' ? args[0] : args[1] || args[0];
+ }
+ default: {
+ return firstArgument;
+ }
+ }
+ })();
+
+ return { action: action as AgentBrowserAction, value };
+};
+
const PROGRAM_BY_BASENAME: Record<string, CodexCommandProgram> = {
'agent-browser': 'agent-browser',
'git': 'git',
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index d7c5303eb52..7097c209b4b 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -679,6 +679,10 @@ export default {
'Scheduled. This run will continue automatically once the limit resets.',
'cliRateLimitGuide.schedule.scheduledForApprox':
'Scheduled. This run will continue automatically in about {{duration}}.',
+ 'cliRateLimitGuide.schedule.titleAfterReset':
+ 'Scheduled {{name}} to continue after the limit resets',
+ 'cliRateLimitGuide.schedule.titleForApprox':
+ 'Scheduled {{name}} to continue in about {{duration}}',
'cliRateLimitGuide.resetUnknown': 'the quota resets',
'cliRateLimitGuide.title': '{{name}} is temporarily unavailable',
'codexInstallGuide.actions.openDocs': 'Open Install Guide',
@@ -1731,6 +1735,11 @@ export default {
'verifyConfig.verifierTypeDesc.agent': 'Spawn a sub-agent to investigate and judge',
'verifyConfig.verifierTypeDesc.llm': 'Let an LLM judge the result',
'verifyConfig.verifierTypeDesc.program': 'Run a deterministic script to check',
+ 'internalLink.preview.acceptance': 'Acceptance',
+ 'internalLink.preview.acceptanceCounts':
+ '{{passed}}/{{total}} passed · {{exceptions}} exceptions',
+ 'internalLink.preview.acceptanceRounds_one': '{{count}} verification round',
+ 'internalLink.preview.acceptanceRounds_other': '{{count}} verification rounds',
'internalLink.preview.agent': 'Agent',
'internalLink.preview.document': 'Page',
'internalLink.preview.task': 'Task',
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index eebd76c9a1d..877ae44ac4b 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -115,6 +115,17 @@ export default {
'builtins.codex.collabTool.spawnAgent': 'Spawn subagent',
'builtins.codex.collabTool.wait': 'Wait for subagents',
'builtins.codex.commandExecution.agentBrowser': 'Operate browser',
+ 'builtins.codex.agentBrowser.click': 'Clicked element',
+ 'builtins.codex.agentBrowser.eval': 'Evaluated page',
+ 'builtins.codex.agentBrowser.fill': 'Filled input',
+ 'builtins.codex.agentBrowser.focus': 'Focused element',
+ 'builtins.codex.agentBrowser.get': 'Read browser state',
+ 'builtins.codex.agentBrowser.navigate': 'Opened page',
+ 'builtins.codex.agentBrowser.press': 'Pressed key',
+ 'builtins.codex.agentBrowser.screenshot': 'Captured screenshot',
+ 'builtins.codex.agentBrowser.snapshot': 'Read page elements',
+ 'builtins.codex.agentBrowser.type': 'Typed text',
+ 'builtins.codex.agentBrowser.wait': 'Waited for page',
'builtins.codex.commandExecution.gitOperation': 'Git operation',
'builtins.codex.commandExecution.grep': 'Search',
'builtins.codex.commandExecution.noResults': 'No results',
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index bc72a1b7045..3e3164e1438 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -55,6 +55,7 @@ export default {
'acceptance.group.expandAll': 'Expand groups',
'acceptance.group.expandItems': 'Expand checks in this group',
'acceptance.group.passRatio': '{{passed}}/{{total}} passed',
+ 'acceptance.group.uncategorized': 'Other requirements',
'acceptance.history.jump': 'Round {{round}} — click to locate it in the ledger',
'acceptance.latestSummary': 'Latest report summary',
'acceptance.ledger.collapse': 'Collapse the round ledger',
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
index b8626250d34..fb414f0b075 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
@@ -4,7 +4,13 @@ import { isDesktop } from '@lobechat/const';
import { RENDERER_HANDLED_LINK_ATTR } from '@lobechat/desktop-bridge';
import { Icon } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { BotIcon, CheckCircleIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
+import {
+ BadgeCheckIcon,
+ BotIcon,
+ CheckCircleIcon,
+ CheckSquareIcon,
+ FileTextIcon,
+} from 'lucide-react';
import type { MouseEvent } from 'react';
import { memo, useCallback } from 'react';
@@ -52,6 +58,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}));
const ENTITY_ICONS = {
+ acceptance: BadgeCheckIcon,
agent: BotIcon,
document: FileTextIcon,
task: CheckSquareIcon,
@@ -107,6 +114,10 @@ export const InternalEntityLink = memo<InternalEntityLinkProps>(({ href, label,
}
switch (reference.type) {
+ case 'acceptance': {
+ navigate(reference.pathname);
+ break;
+ }
case 'agent': {
openAgentDetail(reference.agentId);
break;
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
index d68604fa33c..f609eb21527 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
@@ -3,7 +3,13 @@
import { Avatar, Flexbox, Icon, Popover, Skeleton, Text } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import type { TFunction } from 'i18next';
-import { BotIcon, CheckCircleIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
+import {
+ BadgeCheckIcon,
+ BotIcon,
+ CheckCircleIcon,
+ CheckSquareIcon,
+ FileTextIcon,
+} from 'lucide-react';
import { memo, type PropsWithChildren, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -105,6 +111,28 @@ const getPreviewData = async (
t: TFunction<'chat'>,
): Promise<PreviewData | null> => {
switch (reference.type) {
+ case 'acceptance': {
+ const bundle = await verifyService.getAcceptanceBundle(reference.acceptanceId);
+ if (!bundle) return null;
+
+ const passed = bundle.checks.filter((check) => check.state === 'passed').length;
+ const exceptions = bundle.checks.filter(
+ (check) => check.state === 'failed' || check.state === 'uncertain',
+ ).length;
+
+ return {
+ description: bundle.acceptance.requirement || bundle.latestReport?.summary,
+ meta: t('internalLink.preview.acceptanceCounts', {
+ exceptions,
+ passed,
+ total: bundle.checks.length,
+ }),
+ secondaryMeta: t('internalLink.preview.acceptanceRounds', {
+ count: bundle.rounds.length,
+ }),
+ title: bundle.subject.title || bundle.subject.id,
+ };
+ }
case 'agent': {
return agentService.getAgentConfigById(reference.agentId);
}
@@ -176,13 +204,15 @@ export const InternalEntityPreview = memo<InternalEntityPreviewProps>(
);
const icon =
- reference.type === 'agent'
- ? BotIcon
- : reference.type === 'task'
- ? CheckSquareIcon
- : reference.type === 'verify'
- ? CheckCircleIcon
- : FileTextIcon;
+ reference.type === 'acceptance'
+ ? BadgeCheckIcon
+ : reference.type === 'agent'
+ ? BotIcon
+ : reference.type === 'task'
+ ? CheckSquareIcon
+ : reference.type === 'verify'
+ ? CheckCircleIcon
+ : FileTextIcon;
const typeLabel = t(`internalLink.preview.${reference.type}`);
const content = isLoading ? (
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
index 1116e847bfe..dfed5c3db8a 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
@@ -169,6 +169,18 @@ describe('Link Render — message link icon toggle', () => {
});
describe('Link Render — internal entities', () => {
+ it('renders acceptance links as dedicated entities and navigates in-app', () => {
+ const { getByRole } = renderLink({
+ linkHref: '/acceptance/acceptance-1',
+ linkKind: 'generic',
+ linkLabel: 'Acceptance',
+ });
+
+ fireEvent.click(getByRole('link', { name: 'Acceptance' }));
+
+ expect(mockNavigate).toHaveBeenCalledWith('/acceptance/acceptance-1');
+ });
+
it('opens official document links in the conversation portal', () => {
const { getByRole } = renderLink({
linkHref: '/agent/agt_1/docs/doc1',
diff --git a/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts b/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
index 8d8f21e73d0..45e85d36512 100644
--- a/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
+++ b/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
@@ -50,6 +50,22 @@ describe('parseInternalLink', () => {
});
});
+ it('parses acceptance links as dedicated entities', () => {
+ expect(parseInternalLink('https://app.lobehub.com/acceptance/acceptance-1')).toEqual({
+ acceptanceId: 'acceptance-1',
+ pathname: '/acceptance/acceptance-1',
+ type: 'acceptance',
+ });
+ expect(
+ parseInternalLink('/lobe-team/acceptance/acceptance-2', undefined, ['lobe-team']),
+ ).toEqual({
+ acceptanceId: 'acceptance-2',
+ pathname: '/lobe-team/acceptance/acceptance-2',
+ type: 'acceptance',
+ workspaceSlug: 'lobe-team',
+ });
+ });
+
it('parses workspace-prefixed entity paths', () => {
expect(
parseInternalLink('/lobe-team/agent/agt_agent/docs/docs_document', undefined, ['lobe-team']),
diff --git a/src/features/Conversation/Markdown/plugins/Link/internalLink.ts b/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
index da906a64a44..7be8279c3c4 100644
--- a/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
+++ b/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
@@ -3,11 +3,12 @@ import { OFFICIAL_URL } from '@lobechat/const';
import { getIdFromIdentifier } from '@/utils/identifier';
-const ROUTE_ROOTS = new Set(['agent', 'page', 'task', 'tasks', 'verify']);
+const ROUTE_ROOTS = new Set(['acceptance', 'agent', 'page', 'task', 'tasks', 'verify']);
const BUILTIN_AGENT_SLUG_SET = new Set<string>(Object.values(BUILTIN_AGENT_SLUGS));
const NON_SPA_ROUTE_ROOTS = new Set(['_next', 'api', 'f', 'oidc', 'trpc', 'webapi']);
const SPA_ROUTE_ROOTS = new Set([
'agent',
+ 'acceptance',
'community',
'downloads',
'eval',
@@ -25,6 +26,7 @@ const SPA_ROUTE_ROOTS = new Set([
]);
export type InternalLinkReference =
+ | { acceptanceId: string; pathname: string; type: 'acceptance'; workspaceSlug?: string }
| { agentId: string; pathname: string; type: 'agent'; workspaceSlug?: string }
| {
agentId?: string;
@@ -110,6 +112,15 @@ export const parseInternalLink = (
const { segments, workspaceSlug } = route;
+ if (segments[0] === 'acceptance' && segments[1]) {
+ return {
+ acceptanceId: segments[1],
+ pathname,
+ type: 'acceptance',
+ ...(workspaceSlug ? { workspaceSlug } : {}),
+ };
+ }
+
if (segments[0] === 'page' && segments[1]) {
return {
documentId: getIdFromIdentifier(segments[1], 'docs'),
diff --git a/src/features/Electron/HeterogeneousAgent/StatusGuide/states/RateLimitState.tsx b/src/features/Electron/HeterogeneousAgent/StatusGuide/states/RateLimitState.tsx
index 57c9f50d30c..b949a991f8d 100644
--- a/src/features/Electron/HeterogeneousAgent/StatusGuide/states/RateLimitState.tsx
+++ b/src/features/Electron/HeterogeneousAgent/StatusGuide/states/RateLimitState.tsx
@@ -135,11 +135,19 @@ const RateLimitState = ({
}, [onRetry, relativeDuration, schedule, t]);
const isScheduled = Boolean(schedule?.isScheduled);
+ const title = isScheduled
+ ? relativeDuration
+ ? t('cliRateLimitGuide.schedule.titleForApprox', {
+ duration: relativeDuration,
+ name: config.title,
+ })
+ : t('cliRateLimitGuide.schedule.titleAfterReset', { name: config.title })
+ : t('cliRateLimitGuide.title', { name: config.title });
return (
<GuideShell
icon={<config.icon size={24} />}
- title={t('cliRateLimitGuide.title', { name: config.title })}
+ title={title}
variant={variant}
actions={
scheduleActions ?? (
@@ -154,23 +162,21 @@ const RateLimitState = ({
)
}
headerDescription={
- <Text type="secondary">
- {isScheduled
- ? relativeDuration
- ? t('cliRateLimitGuide.schedule.scheduledForApprox', { duration: relativeDuration })
- : t('cliRateLimitGuide.schedule.scheduledAfterReset')
- : t(
- rateLimitTypeLabel
- ? 'cliRateLimitGuide.afterResetWithLimitType'
- : 'cliRateLimitGuide.afterReset',
- {
- limitType: rateLimitTypeLabel,
- resetAt: formattedResetAt
- ? `${formattedResetAt}${timezoneLabel ? ` (${timezoneLabel})` : ''}`
- : t('cliRateLimitGuide.resetUnknown'),
- },
- )}
- </Text>
+ !isScheduled && (
+ <Text type="secondary">
+ {t(
+ rateLimitTypeLabel
+ ? 'cliRateLimitGuide.afterResetWithLimitType'
+ : 'cliRateLimitGuide.afterReset',
+ {
+ limitType: rateLimitTypeLabel,
+ resetAt: formattedResetAt
+ ? `${formattedResetAt}${timezoneLabel ? ` (${timezoneLabel})` : ''}`
+ : t('cliRateLimitGuide.resetUnknown'),
+ },
+ )}
+ </Text>
+ )
}
onDismiss={onDismiss}
>
diff --git a/src/features/Verify/Acceptance/CheckList.test.ts b/src/features/Verify/Acceptance/CheckList.test.ts
new file mode 100644
index 00000000000..30e0f2685e2
--- /dev/null
+++ b/src/features/Verify/Acceptance/CheckList.test.ts
@@ -0,0 +1,42 @@
+import { describe, expect, it } from 'vitest';
+
+import { type AcceptanceCheck, groupChecks } from './CheckList';
+
+const check = (id: string, category: string | null, surface: AcceptanceCheck['surface']) =>
+ ({ category, id, surface }) as AcceptanceCheck;
+
+describe('groupChecks', () => {
+ it('groups checks by business category', () => {
+ const groups = groupChecks(
+ [
+ check('duration', 'Rate-limit recovery', 'desktop'),
+ check('reset', 'Rate-limit recovery', 'cli'),
+ check('browser', 'Browser actions', 'desktop'),
+ ],
+ 'Other requirements',
+ );
+
+ expect(
+ groups.map(({ key, label, checks }) => ({ ids: checks.map((item) => item.id), key, label })),
+ ).toEqual([
+ {
+ ids: ['duration', 'reset'],
+ key: 'category:Rate-limit recovery',
+ label: 'Rate-limit recovery',
+ },
+ { ids: ['browser'], key: 'category:Browser actions', label: 'Browser actions' },
+ ]);
+ });
+
+ it('never falls back to technical surfaces', () => {
+ const groups = groupChecks(
+ [check('desktop', null, 'desktop'), check('cli', null, 'cli')],
+ 'Other requirements',
+ );
+
+ expect(groups).toHaveLength(1);
+ expect(groups[0]?.key).toBe('uncategorized');
+ expect(groups[0]?.label).toBe('Other requirements');
+ expect(groups[0]?.checks.map((item) => item.id)).toEqual(['desktop', 'cli']);
+ });
+});
diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsx
index 667d05107fe..f500d155189 100644
--- a/src/features/Verify/Acceptance/CheckList.tsx
+++ b/src/features/Verify/Acceptance/CheckList.tsx
@@ -481,18 +481,16 @@ interface CheckGroup {
}
/**
- * Group by the harness-authored `category`, falling back to the product
- * surface, then a catch-all — familiar sections over storage taxonomy (P-14).
+ * Group by the harness-authored business `category`. Product surfaces describe
+ * where a check ran, not what user requirement it verifies, so they must never
+ * become acceptance sections.
*/
-export const groupChecks = (
- checks: AcceptanceCheck[],
- surfaceLabel: (surface: NonNullable<AcceptanceCheck['surface']>) => string,
- otherLabel: string,
-): CheckGroup[] => {
+export const groupChecks = (checks: AcceptanceCheck[], otherLabel: string): CheckGroup[] => {
const groups = new Map<string, CheckGroup>();
for (const check of checks) {
- const key = check.category ?? (check.surface ? `surface:${check.surface}` : 'other');
- const label = check.category ?? (check.surface ? surfaceLabel(check.surface) : otherLabel);
+ const category = check.category?.trim();
+ const key = category ? `category:${category}` : 'uncategorized';
+ const label = category || otherLabel;
const group = groups.get(key) ?? { checks: [], key, label };
group.checks.push(check);
groups.set(key, group);
@@ -531,11 +529,7 @@ const CheckList = memo<CheckListProps>(
return true;
};
- const groups = groupChecks(
- checks,
- (surface) => t(`report.surface.${surface}`),
- t('acceptance.surface.other'),
- )
+ const groups = groupChecks(checks, t('acceptance.group.uncategorized'))
.map((group) => ({
...group,
rows: group.checks
diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsx
index d800c4bfc1e..ea4893a2d7a 100644
--- a/src/features/Verify/Acceptance/index.tsx
+++ b/src/features/Verify/Acceptance/index.tsx
@@ -9,7 +9,6 @@ import {
Flexbox,
Icon,
Markdown,
- ScrollShadow,
Tag,
Text,
} from '@lobehub/ui';
@@ -61,6 +60,7 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorBgContainer};
`,
page: css`
+ position: relative;
overflow: hidden;
height: 100%;
background: ${cssVar.colorBgLayout};
@@ -164,11 +164,9 @@ const AcceptancePage = memo(() => {
// The scope header comes from the latest round that carries a coding context.
const scope = [...rounds].reverse().find((round) => round.run.context)?.run.context;
- const groupKeys = groupChecks(
- checks,
- (surface) => t(`report.surface.${surface}`),
- t('acceptance.surface.other'),
- ).map((group) => group.key);
+ const groupKeys = groupChecks(checks, t('acceptance.group.uncategorized')).map(
+ (group) => group.key,
+ );
const allGroupsCollapsed =
groupKeys.length > 0 && groupKeys.every((key) => collapsedGroups.has(key));
@@ -327,168 +325,166 @@ const AcceptancePage = memo(() => {
return (
<Flexbox horizontal className={styles.page}>
- <Flexbox flex={1} style={{ minWidth: 0 }}>
- <ScrollShadow style={{ height: '100%' }}>
- <Flexbox
- gap={16}
- paddingBlock={20}
- paddingInline={24}
- style={{ margin: '0 auto', maxWidth: 920, width: '100%' }}
- >
- {/* Header — the accepted object and its scope */}
- <Flexbox gap={8}>
- <Flexbox horizontal align={'center'} gap={10}>
- <Text as={'h1'} style={{ fontSize: 18, margin: 0 }}>
- {subject.title ?? subject.id}
- </Text>
- <Tag size={'small'}>{t(`acceptance.subject.${subject.type}`)}</Tag>
- <Flexbox flex={1} />
- {!ledgerExpand && (
- <ActionIcon
- icon={PanelRightOpen}
- size={'small'}
- title={t('acceptance.ledger.expand')}
- onClick={() => setLedgerExpand(true)}
- />
- )}
- </Flexbox>
- <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
- {scope?.branch && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitBranch} size={13} /> {scope.branch}
- </Flexbox>
- )}
- {scope?.commit && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitCommitHorizontal} size={13} /> {scope.commit.slice(0, 10)}
- </Flexbox>
- )}
- {scope?.pullRequest?.number && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={GitPullRequest} size={13} /> #{scope.pullRequest.number}
- </Flexbox>
- )}
+ <Flexbox flex={1} style={{ minWidth: 0, overflow: 'auto' }}>
+ <Flexbox
+ gap={16}
+ paddingBlock={20}
+ paddingInline={24}
+ style={{ margin: '0 auto', maxWidth: 920, width: '100%' }}
+ >
+ {/* Header — the accepted object and its scope */}
+ <Flexbox gap={8}>
+ <Flexbox horizontal align={'center'} gap={10}>
+ <Text as={'h1'} style={{ fontSize: 18, margin: 0 }}>
+ {subject.title ?? subject.id}
+ </Text>
+ <Tag size={'small'}>{t(`acceptance.subject.${subject.type}`)}</Tag>
+ <Flexbox flex={1} />
+ {!ledgerExpand && (
+ <ActionIcon
+ icon={PanelRightOpen}
+ size={'small'}
+ title={t('acceptance.ledger.expand')}
+ onClick={() => setLedgerExpand(true)}
+ />
+ )}
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
+ {scope?.branch && (
<Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
- <Icon icon={FileClock} size={13} />{' '}
- {t('acceptance.roundCount', { count: rounds.length })}
+ <Icon icon={GitBranch} size={13} /> {scope.branch}
</Flexbox>
+ )}
+ {scope?.commit && (
+ <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
+ <Icon icon={GitCommitHorizontal} size={13} /> {scope.commit.slice(0, 10)}
+ </Flexbox>
+ )}
+ {scope?.pullRequest?.number && (
+ <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
+ <Icon icon={GitPullRequest} size={13} /> #{scope.pullRequest.number}
+ </Flexbox>
+ )}
+ <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
+ <Icon icon={FileClock} size={13} />{' '}
+ {t('acceptance.roundCount', { count: rounds.length })}
</Flexbox>
</Flexbox>
+ </Flexbox>
- {/* The acceptance bar — what this delivery is judged against.
+ {/* The acceptance bar — what this delivery is judged against.
Prominence through typography (a lede under the heading), not
chrome: no card, no border. */}
- {acceptance.requirement && (
- <Flexbox gap={4} style={{ maxWidth: 760 }}>
- <Text className={styles.requirementLabel}>{t('acceptance.requirementLabel')}</Text>
- <Text style={{ fontSize: 15, lineHeight: 1.7 }}>{acceptance.requirement}</Text>
- </Flexbox>
- )}
+ {acceptance.requirement && (
+ <Flexbox gap={4} style={{ maxWidth: 760 }}>
+ <Text className={styles.requirementLabel}>{t('acceptance.requirementLabel')}</Text>
+ <Text style={{ fontSize: 15, lineHeight: 1.7 }}>{acceptance.requirement}</Text>
+ </Flexbox>
+ )}
- {/* Decision bar — the user closes the lifecycle (P-12). Hidden
+ {/* Decision bar — the user closes the lifecycle (P-12). Hidden
until the accept/reject loop ships. */}
- {ENABLE_DECISION_BAR && decisionBanner()}
- {ENABLE_DECISION_BAR && actionError && <Text type={'danger'}>{actionError}</Text>}
-
- {/* Latest report narrative — an entry point, not the page's spine */}
- {latestReport?.summary && (
- <Flexbox className={styles.card} gap={8} padding={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <Icon color={cssVar.colorTextSecondary} icon={FileText} size={15} />
- <Text strong style={{ fontSize: 13 }}>
- {t('acceptance.latestSummary')}
- {currentRound
- ? ` · ${t('acceptance.round', { round: currentRound.run.roundIndex })}`
- : ''}
- </Text>
- <Flexbox flex={1} />
- <Button
- size={'small'}
- type={'text'}
- onClick={() =>
- setReportRound([...rounds].reverse().find((r) => r.report) ?? null)
- }
- >
- {t('acceptance.viewFullReport')}
- </Button>
- </Flexbox>
- <Text className={styles.summaryClamp} fontSize={13} type={'secondary'}>
- {latestReport.summary}
+ {ENABLE_DECISION_BAR && decisionBanner()}
+ {ENABLE_DECISION_BAR && actionError && <Text type={'danger'}>{actionError}</Text>}
+
+ {/* Latest report narrative — an entry point, not the page's spine */}
+ {latestReport?.summary && (
+ <Flexbox className={styles.card} gap={8} padding={16}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Icon color={cssVar.colorTextSecondary} icon={FileText} size={15} />
+ <Text strong style={{ fontSize: 13 }}>
+ {t('acceptance.latestSummary')}
+ {currentRound
+ ? ` · ${t('acceptance.round', { round: currentRound.run.roundIndex })}`
+ : ''}
</Text>
+ <Flexbox flex={1} />
+ <Button
+ size={'small'}
+ type={'text'}
+ onClick={() =>
+ setReportRound([...rounds].reverse().find((r) => r.report) ?? null)
+ }
+ >
+ {t('acceptance.viewFullReport')}
+ </Button>
</Flexbox>
- )}
-
- {/* Check union — the complete inventory, familiar sections (P-14) */}
- <Flexbox horizontal align={'center'} gap={12}>
- <Text strong style={{ fontSize: 14 }}>
- {t('acceptance.checks.title')}
- </Text>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.checks.subtitle', { count: counts.total, rounds: rounds.length })}
+ <Text className={styles.summaryClamp} fontSize={13} type={'secondary'}>
+ {latestReport.summary}
</Text>
- <Flexbox flex={1} />
- <Segmented
- size={'small'}
- value={filter}
- options={[
- { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
- {
- label: t('acceptance.filter.exception', { count: counts.exceptions }),
- value: 'exception',
- },
- { label: t('acceptance.filter.fixed', { count: counts.fixed }), value: 'fixed' },
- ]}
- onChange={(value) => setFilter(value as CheckFilter)}
- />
- <Button
- icon={<Icon icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp} />}
- size={'small'}
- onClick={() =>
- setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))
- }
- >
- {allGroupsCollapsed
- ? t('acceptance.group.expandAll')
- : t('acceptance.group.collapseAll')}
- </Button>
</Flexbox>
+ )}
- <CheckList
- checks={checks}
- collapsedGroups={collapsedGroups}
- expanded={expanded}
- filter={filter}
- onRound={gotoRound}
- onToggleGroup={(key) =>
- setCollapsedGroups((previous) => {
- const next = new Set(previous);
- if (next.has(key)) next.delete(key);
- else next.add(key);
- return next;
- })
- }
- onToggleGroupItems={(ids, open) =>
- setExpanded((previous) => {
- const next = new Set(previous);
- for (const id of ids) {
- if (open) next.add(id);
- else next.delete(id);
- }
- return next;
- })
- }
- onToggleItem={(id) =>
- setExpanded((previous) => {
- const next = new Set(previous);
- if (next.has(id)) next.delete(id);
- else next.add(id);
- return next;
- })
- }
+ {/* Check union — the complete inventory, familiar sections (P-14) */}
+ <Flexbox horizontal align={'center'} gap={12}>
+ <Text strong style={{ fontSize: 14 }}>
+ {t('acceptance.checks.title')}
+ </Text>
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.checks.subtitle', { count: counts.total, rounds: rounds.length })}
+ </Text>
+ <Flexbox flex={1} />
+ <Segmented
+ size={'small'}
+ value={filter}
+ options={[
+ { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
+ {
+ label: t('acceptance.filter.exception', { count: counts.exceptions }),
+ value: 'exception',
+ },
+ { label: t('acceptance.filter.fixed', { count: counts.fixed }), value: 'fixed' },
+ ]}
+ onChange={(value) => setFilter(value as CheckFilter)}
/>
- <Flexbox style={{ height: 24 }} />
+ <Button
+ icon={<Icon icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp} />}
+ size={'small'}
+ onClick={() =>
+ setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))
+ }
+ >
+ {allGroupsCollapsed
+ ? t('acceptance.group.expandAll')
+ : t('acceptance.group.collapseAll')}
+ </Button>
</Flexbox>
- </ScrollShadow>
+
+ <CheckList
+ checks={checks}
+ collapsedGroups={collapsedGroups}
+ expanded={expanded}
+ filter={filter}
+ onRound={gotoRound}
+ onToggleGroup={(key) =>
+ setCollapsedGroups((previous) => {
+ const next = new Set(previous);
+ if (next.has(key)) next.delete(key);
+ else next.add(key);
+ return next;
+ })
+ }
+ onToggleGroupItems={(ids, open) =>
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ for (const id of ids) {
+ if (open) next.add(id);
+ else next.delete(id);
+ }
+ return next;
+ })
+ }
+ onToggleItem={(id) =>
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ if (next.has(id)) next.delete(id);
+ else next.add(id);
+ return next;
+ })
+ }
+ />
+ <Flexbox style={{ height: 24 }} />
+ </Flexbox>
</Flexbox>
{/* Round ledger — audit detail, off the decision path (P-13) */}
@@ -499,16 +495,17 @@ const AcceptancePage = memo(() => {
expand={ledgerExpand}
minWidth={300}
placement={'right'}
+ style={{ flex: 'none', height: '100%' }}
onExpandChange={setLedgerExpand}
>
- <ScrollShadow style={{ height: '100%' }}>
+ <Flexbox style={{ height: '100%', overflow: 'auto' }}>
<LedgerPanel
highlight={highlightRound}
rounds={rounds}
onCollapse={() => setLedgerExpand(false)}
onOpenReport={setReportRound}
/>
- </ScrollShadow>
+ </Flexbox>
</DraggablePanel>
{/* Per-round report drill-down */}