Skip to content

feat(managed-agents): Agents 列表 Created 过滤器支持自定义日期范围 - #111

Open
Postroggy wants to merge 5 commits into
superduck-ai:mainfrom
Postroggy:feat/agents-created-custom-range
Open

feat(managed-agents): Agents 列表 Created 过滤器支持自定义日期范围#111
Postroggy wants to merge 5 commits into
superduck-ai:mainfrom
Postroggy:feat/agents-created-custom-range

Conversation

@Postroggy

@Postroggy Postroggy commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

背景

#109

Agents 列表页(/workspaces/default/agents)的「Created」过滤器切到 Custom Range 时缺少日期选择控件,本 PR 实现完整的自定义日期区间过滤。

实现

  • 类型AgentCreatedFilter 重构为可辨识联合,preset(all / last7 / last30)与 custom({ from, to }yyyy-MM-dd)统一表达。
  • UI:新增 CreatedFilterDropdown(Popover + shadcn Calendar,基于 react-day-picker v10 mode="range")。preset 列表改用项目共享的 RadioGroup@base-ui),获得方向键选择与 roving tabindex;样式保持整行选项。preset 点击即时生效;Custom range 为折叠入口,点开后用日历选 from → to,Apply 后提交;当前值已是 custom 时打开默认展开,便于编辑。
  • 数据listAgents 同时发送 created_at[gte]created_at[lte](custom 的两个日期映射为 UTC 日始 / 日末);客户端过滤 agentMatchesClientFilters 同步支持上下界。后端 internal/agents/handler.go 已解析 [gte] / [lte],无需后端改动。
  • 时区 / localelabels.ts 改用 date-fns parseISO 解析 yyyy-MM-dd(修复 Date.parse 当 UTC 导致 UTC− 时区 off-by-one 的标签偏移);trigger 与 draft 共用 locale-aware 的 formatCreatedRange / formatCreatedRangeDay(基于 Intl.DateTimeFormat(locale)),中文界面不再固定英文月份。
  • 依赖:新增 react-day-pickerdate-fns 与 shadcn Calendar 组件;移除误加的未使用 radix-ui 直接依赖。

改动文件

  • web/src/features/managed-agents/types.tslabels.ts(含新增 formatCreatedRange / formatCreatedRangeDay)、api.tsagents/model.tsx
  • web/src/features/managed-agents/agents/AgentsResourcePage.tsx(改用 CreatedFilterDropdown
  • web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx(新增 / RadioGroup 化)
  • web/src/shared/ui/calendar.tsx(shadcn 新增)
  • web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx(适配新交互 + 新增 Custom Range 端到端与 zh-CN locale 测试)
  • web/src/features/managed-agents/labels.test.ts(新增:UTC− 时区 / locale / invalid fallback / range 折叠)
  • docs/design/fe/agents-created-filter.md(设计文档)

验证

  • bun run build(tsc + vite)通过
  • 前端门禁:prettier / complexity / duplicates / naming 通过
  • bun test:含 labels.test.ts(TZ=America/Los_Angeles)与 suite 新增用例,全绿
  • 手动:preset 即时生效;Custom range 日历选 from → to 后 Apply,列表按区间刷新;键盘方向键可在 preset 与日历间移动;UTC− 时区下 trigger 标签与选中日一致

不在本期范围

Custom Range 的 URL 序列化与刷新恢复(#109 验收计划中提及)拆到后续 issue #135 单独跟踪;本 PR 选择范围不持久化到 URL,刷新会回到 All time。#109 的验收范围相应调整为「preset + Custom Range 选择与 API 边界」,URL 恢复由 #135 承接。

关联

实现 #109;URL 恢复后续见 #135。设计细节见 docs/design/fe/agents-created-filter.md

Summary by CodeRabbit

  • New Features

    • Added a Created-date filter for managed agents with presets for all time, the last 7 days, and the last 30 days.
    • Added custom date-range selection with calendar controls, Apply, and Clear actions.
    • Added localized date-range labels, including Simplified Chinese support.
    • Improved date filtering to use inclusive start and end boundaries.
  • Bug Fixes

    • Prevented draft custom date selections from triggering requests before Apply.
    • Fixed timezone-sensitive date parsing and range display.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Postroggy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cadea1f-cf5e-4c24-b633-50aa4750e945

📥 Commits

Reviewing files that changed from the base of the PR and between 12e9e39 and 343b412.

📒 Files selected for processing (2)
  • web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx
  • web/src/shared/ui/calendar.tsx
📝 Walkthrough

Walkthrough

The managed-agent Created filter now supports structured presets and custom calendar ranges, inclusive API bounds, localized labels, stable request identities, and draft Apply behavior. A shared calendar component, dependency updates, page integration, design documentation, and automated coverage were added.

Changes

Created-date filtering

Layer / File(s) Summary
Created-filter contract and range handling
web/src/features/managed-agents/types.ts, web/src/features/managed-agents/api.ts, web/src/features/managed-agents/agents/model.tsx, web/src/features/managed-agents/labels.test.ts
Created filters use discriminated objects, custom ranges produce inclusive created_at bounds, request keys include range boundaries, and client filtering enforces both limits.
Created-filter picker and presentation
web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx, web/src/shared/ui/calendar.tsx, web/src/features/managed-agents/labels.ts, web/package.json
Preset and custom-range controls use a calendar-based popover with draft state, date-fns parsing, localized labels, and new calendar dependencies.
Page integration and UI validation
web/src/features/managed-agents/agents/AgentsResourcePage.tsx, web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx, web/src/features/managed-agents/labels.test.ts, docs/design/fe/agents-created-filter.md
The agents page uses the dedicated dropdown and structured request identity; tests cover radio roles, deferred custom-range requests, inclusive bounds, localization, and formatting behavior, with the interaction model documented.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CreatedFilterDropdown
  participant AgentsResourcePage
  participant listAgents
  participant AgentAPI
  User->>CreatedFilterDropdown: select preset or draft calendar range
  CreatedFilterDropdown->>AgentsResourcePage: commit filter on preset or Apply
  AgentsResourcePage->>listAgents: request using created-filter key
  listAgents->>AgentAPI: send inclusive created_at bounds
  AgentAPI-->>listAgents: return matching agents
Loading

Possibly related issues

  • Issue 109 — The PR implements the requested custom Created date-range filter across types, UI, API bounds, and tests.

Suggested reviewers: arthur-zhang, cursor

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding custom date-range support to the Managed Agents Created filter.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/features/managed-agents/labels.ts`:
- Around line 114-124: Update formatCustomCreatedRange to parse filter.from and
filter.to with date-fns parseISO instead of Date.parse, adding parseISO to the
existing date-fns imports. Preserve the existing invalid-date fallback and
range-label formatting behavior.

In `@web/src/shared/ui/calendar.tsx`:
- Around line 132-139: Remove the local ref and the useEffect focus logic from
the calendar button component; rely on react-day-picker’s built-in roving
tabindex and keyboard navigation while preserving the existing Button rendering
and props.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b532321a-d57b-4123-88cf-75fad433b508

📥 Commits

Reviewing files that changed from the base of the PR and between e209f2d and f95f16f.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • web/package.json
  • web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx
  • web/src/features/managed-agents/agents/AgentsResourcePage.tsx
  • web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx
  • web/src/features/managed-agents/agents/model.tsx
  • web/src/features/managed-agents/api.ts
  • web/src/features/managed-agents/labels.ts
  • web/src/features/managed-agents/types.ts
  • web/src/shared/ui/calendar.tsx

Comment thread web/src/features/managed-agents/labels.ts Outdated
Comment thread web/src/shared/ui/calendar.tsx

@duckpr duckpr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DuckPR reviewer: opencode
Model: anthropic/glm-5.2

Important

有两处需要修正的问题:package.json 中引入了未使用的 radix-ui 依赖;labels.ts 中 Custom Range 的日期标签在非 UTC 时区下会出现跨日偏差。具体位置及修改建议见行内评论。

Reviewed changes — 本次 PR 为 Agents 列表的「Created」过滤器实现了 Custom Range 自定义日期区间,并将 AgentCreatedFilter 重构为 discriminated union,同时新增 CreatedFilterDropdown 与 shadcn Calendar 组件。

  • AgentCreatedFilter 改为 { kind } discriminated union,支持 all/last7/last30{ kind: 'custom'; from: string; to: string }
  • createdFilterRange 将 custom 日期映射为 created_at[gte]created_at[lte] 的 UTC 日边界。
  • CreatedFilterDropdown 用 Popover + react-day-picker 实现 preset 即时选择与 Custom Range 折叠面板。
  • web/src/shared/ui/calendar.tsx 新增 shadcn 风格 Calendar 组件。
  • ManagedAgentsPage.agents.suite.tsx 同步将 filter 断言从 menuitemradio 调整为 radio

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using anthropic/glm-5.2𝕏

Comment thread web/package.json Outdated
Comment thread web/src/features/managed-agents/labels.ts Outdated
Comment thread web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx
@Postroggy Postroggy changed the title Agents 列表「Created」过滤器支持 Custom Range 自定义日期范围 [Managed Agents] Agents 列表「Created」过滤器支持自定义日期范围 Jul 18, 2026
@Postroggy Postroggy changed the title [Managed Agents] Agents 列表「Created」过滤器支持自定义日期范围 feat(managed-agents): Agents 列表 Created 过滤器支持自定义日期范围 Jul 19, 2026

@jh0904 jh0904 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.

整体方向没问题,类型和 API 上下界这条链路也已经接起来了。我在 PR head 上跑了完整前端测试、build、format、naming、complexity 和 duplicates,都是通过的。这里先 request changes,主要是几个现有测试没有覆盖到的问题:
1.日期标签的时区和多语言
2.Custom Range 的实际交互测试
3.RadioGroup 键盘行为,以及未使用依赖。
#109 里写到的 URL 恢复可以拆到后续 PR;如果这次不做,麻烦建一个跟踪 issue,并同步调整 #109 的验收范围和本 PR 描述,避免看起来已经完整交付。这个改动也请补一下对应的 design 文档。另:CalendarDayButton 的 ref/effect 我对过 react-day-picker 10.0.1 的上游实现,默认 DayButton 本身就是同样的逻辑,这条不需要按 bot 建议删除。修完后请再跑一遍现有门禁,并手动检查一下键盘方向键选择和 UTC− 时区下的日期显示。

Comment thread web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx Outdated
Comment thread web/src/features/managed-agents/agents/AgentsResourcePage.tsx
Postroggy added a commit to Postroggy/open-managed-agents that referenced this pull request Jul 20, 2026
响应 superduck-ai#111 review (@jh0904) 的 request changes:

- labels.ts:custom range 解析改用 date-fns parseISO(yyyy-MM-dd 按本地日),
  修复 Date.parse 当 UTC 导致 UTC− 时区标签偏移一天;抽出 locale-aware 的
  formatCreatedRange / formatCreatedRangeDay(基于 Intl.DateTimeFormat),
  trigger 与 draft 共用,中文界面不再固定英文月份
- CreatedFilterDropdown:preset 列表改用项目共享 RadioGroup(@base-ui)+
  Radio.Root,获得方向键选择与 roving tabindex,样式保持整行选项;
  trigger 与 draft label 传 locale
- package.json:移除未使用的 radix-ui 直接依赖并重新生成 bun.lock,
  避免带入整套 @radix-ui/* 元包
- 测试:labels.test.ts 在 TZ=America/Los_Angeles 下覆盖 UTC− 时区 / locale
  / invalid fallback / range 折叠;suite 新增 Custom Range 端到端(Apply 前
  不发请求、Apply 后同时带 created_at[gte]/[lte]、上下界值正确)与 zh-CN
  locale 用例
- docs/design/fe/agents-created-filter.md:补充设计文档(类型/UI/API 边界
  /时区/键盘可达性/测试计划)
- calendar.tsx 的 DayButton ref 按 review 结论保留(与上游 react-day-picker
  默认实现一致)

URL 序列化与刷新恢复按 review 共识拆到 superduck-ai#135 单独跟踪;本 PR 不含。
@Postroggy

Copy link
Copy Markdown
Contributor Author

@jh0904 感谢,request changes 都处理了:

  • labels.ts:custom range 解析改用 parseISOyyyy-MM-dd 按本地日),UTC− 时区不再偏移一天;抽出 locale-aware 的 formatCreatedRange / formatCreatedRangeDay(基于 Intl.DateTimeFormat),trigger 与 draft 共用,中文界面用中文月份。
  • CreatedFilterDropdown:preset 列表改用项目共享 RadioGroup@base-ui)+ Radio.Root,方向键选择和 roving tabindex 有了,样式保持整行选项;trigger 与 draft label 都传 locale。
  • package.json:删掉没用到的 radix-ui 直接依赖,bun.lock 重新生成。
  • 测试labels.test.tsTZ=America/Los_Angeles 下覆盖 UTC− 时区 / locale / invalid fallback / 同日折叠;suite 新增 Custom Range 端到端(展开 → 选 from/to → Apply 前不发请求 → Apply 后同时带 created_at[gte] / [lte] 且上下界值正确 → trigger label)与 zh-CN locale 用例。
  • calendar.tsxDayButton ref 按你的结论保留(与上游 react-day-picker 默认实现一致)。
  • design 文档docs/design/fe/agents-created-filter.md(类型 / UI / API 边界 / 时区 / 键盘可达性 / 测试计划)。
  • URL 恢复:拆到 [Managed Agents] Agents Created 过滤器 URL 序列化与刷新恢复 #135#109 验收范围与本 PR 描述同步标注为本期不含。

bun test / build / format / naming / complexity / duplicates 全绿。UTC− 时区用 TZ=America/Los_Angeleslabels.test.ts 里钉住;键盘方向键依赖 RadioGroup@base-ui)和 react-day-picker 的内置行为,radio 语义和 Apply 流程有测试覆盖,方便的话再手动过一遍键盘就稳了。

@duckpr duckpr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DuckPR reviewer: opencode
Model: anthropic/glm-5.2

✅ No new issues found.

Reviewed changes — 本次增量 review 覆盖自 f95f16f4566cde 的新提交,重点验证上轮 Pullfrog review 提出的问题是否已修复。

  • 移除未使用依赖web/package.json 中已删除 radix-ui,并重新生成 web/bun.lock
  • 修复 Custom Range 时区偏移web/src/features/managed-agents/labels.ts 改用 date-fnsparseISO 解析 yyyy-MM-dd,并新增 formatCreatedRange / formatCreatedRangeDay 两个基于 Intl.DateTimeFormat 的本地化 helper,避免 UTC− 时区下标签早一天。
  • preset 列表 RadioGroup 化CreatedFilterDropdown 的 preset 选项改为使用共享 RadioGroup(Base UI),获得方向键导航与 roving tabindex。
  • 补齐交互与时区测试 — 新增 labels.test.ts(UTC− 时区回归)以及 ManagedAgentsPage.agents.suite.tsx 中 Custom Range 端到端测试和 zh-CN 本地化断言。
  • 新增设计文档docs/design/fe/agents-created-filter.md 记录了类型模型、UI 状态、API 边界、时区策略、键盘可达性与测试计划。

Pullfrog  | View workflow run | Using anthropic/glm-5.2𝕏

@Postroggy

Copy link
Copy Markdown
Contributor Author

@jh0904 已按你上一轮的四点逐一修复完毕(commit 4566cde):

  1. 日期标签时区/多语言:labels.ts 改用 date-fnsparseISO 解析 yyyy-MM-dd,新增基于 Intl.DateTimeFormatformatCreatedRange/formatCreatedRangeDay,并补了 labels.test.ts 覆盖 UTC− 时区回归。
  2. Custom Range 交互测试:在 ManagedAgentsPage.agents.suite.tsx 补了端到端测试和 zh-CN 本地化断言。
  3. RadioGroup 键盘行为:preset 列表改用共享 RadioGroup(Base UI),获得方向键导航与 roving tabindex。
  4. 未使用依赖:移除了 package.json 里的 radix-ui,重新生成了 bun.lock

CalendarDayButton 的 ref/effect 按你的判断保留,没有按 bot 建议删除。

另外补了设计文档 docs/design/fe/agents-created-filter.md,记录类型模型、UI 状态、API 边界、时区策略、键盘可达性和测试计划。#109 的 URL 恢复部分我还没拆分成独立 issue,如果需要我现在建一个跟踪 issue 并同步调整验收范围,请告诉我。

现有门禁(build/format/naming/complexity/duplicates)和 CI 全部通过,DuckPR 增量 review 也确认 "No new issues found"。麻烦复核一下,谢谢!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
internal/messages/handler.go (1)

96-125: 🚀 Performance & Scalability | 🔵 Trivial

Operational note: every OAuth code-session Messages request now fully buffers its body in memory.

readGatewayCandidate must read the full request body (up to maxRequestBodyBytes/32MiB) to detect JSON and route to the gateway, whereas previously the body streamed straight to the upstream. This is a reasonable tradeoff for the feature, but worth keeping in mind for memory/latency under high code-session traffic with large payloads (e.g., long conversation histories) that never end up using web search.

Also applies to: 159-190

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/messages/handler.go` around lines 96 - 125, Review the OAuth
code-session path in the Messages handler, especially readGatewayCandidate and
the corresponding handling around lines 159-190, to account for full
request-body buffering up to maxRequestBodyBytes (32 MiB). Preserve gateway
detection and body restoration for non-gateway requests, while ensuring the
implementation’s memory and latency impact is intentional and bounded.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/design/fe/agents-created-filter.md`:
- Around line 76-87: 修正文档中 custom 日期范围的 API 边界契约,使其与用户选择并展示的本地日历日一致:不要固定使用 UTC
午夜和日末;应明确将本地日边界按指定时区转换为 UTC,或统一改为 UTC 日历日并同步调整展示与序列化说明。更新“时区与本地化”及表格中的 from/to
示例,确保整日过滤范围在非 UTC 时区下仍覆盖用户选中的日期。

In `@internal/messages/gateway.go`:
- Around line 304-314: Update gatewayToolResult to serialize successful
[]websearch.Result values before assigning them to tool_result.content. Use JSON
or the established typed text-content block format, ensuring the resulting
content conforms to Anthropic’s accepted string or content-block shape while
preserving the existing error response.

In `@web/src/features/managed-agents/labels.test.ts`:
- Around line 10-18: Update the afterAll cleanup for process.env.TZ to restore
the original state: assign previousTimezone when it was previously defined,
otherwise delete process.env.TZ so the environment variable remains unset.

In `@web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx`:
- Around line 1687-1695: Update the clickDay helper in the ManagedAgentsPage
test to locate DayPicker dates using its actual day-button selector or
accessible role, rather than constructing button[data-day] values in M/D/YYYY
format. Preserve the existing assertions and clicks for the first and fifteenth
days.

---

Nitpick comments:
In `@internal/messages/handler.go`:
- Around line 96-125: Review the OAuth code-session path in the Messages
handler, especially readGatewayCandidate and the corresponding handling around
lines 159-190, to account for full request-body buffering up to
maxRequestBodyBytes (32 MiB). Preserve gateway detection and body restoration
for non-gateway requests, while ensuring the implementation’s memory and latency
impact is intentional and bounded.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ffc4064-ad26-42d9-b02c-13e671d05a15

📥 Commits

Reviewing files that changed from the base of the PR and between f95f16f and 143961c.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • .env.example
  • .gitignore
  • docs/design/be/messages-proxy.md
  • docs/design/fe/agents-created-filter.md
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/messages/gateway.go
  • internal/messages/gateway_test.go
  • internal/messages/handler.go
  • internal/websearch/provider.go
  • internal/websearch/tavily.go
  • internal/websearch/tavily_test.go
  • tests/messages_api_test.go
  • web/package.json
  • web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx
  • web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx
  • web/src/features/managed-agents/labels.test.ts
  • web/src/features/managed-agents/labels.ts
💤 Files with no reviewable changes (1)
  • web/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/features/managed-agents/agents/CreatedFilterDropdown.tsx

Comment thread docs/design/fe/agents-created-filter.md Outdated
Comment thread internal/messages/gateway.go Outdated
Comment thread web/src/features/managed-agents/labels.test.ts
Comment thread web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/config/config_test.go (1)

484-517: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a default-config assertion to catch missing WebSearch.Timeout default.

Both new tests explicitly set timeout in the YAML override, so neither exercises the no-override path. Adding a case for the omitted-timeout default would have caught that defaultConfig() currently leaves WebSearch.Timeout at zero (see comment on internal/config/defaults.go).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/config/config_test.go` around lines 484 - 517, Add a test case near
TestLoadWebSearchConfiguration that loads configuration without a
web_search.timeout override and asserts cfg.WebSearch.Timeout equals the
documented default from defaultConfig. Use the existing prepareLoadTest and
loadConfigTestYAML helpers, while preserving the current explicit-timeout
coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/config/config_test.go`:
- Around line 484-517: Add a test case near TestLoadWebSearchConfiguration that
loads configuration without a web_search.timeout override and asserts
cfg.WebSearch.Timeout equals the documented default from defaultConfig. Use the
existing prepareLoadTest and loadConfigTestYAML helpers, while preserving the
current explicit-timeout coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8db1331e-e00b-4772-911e-734c5e344ccd

📥 Commits

Reviewing files that changed from the base of the PR and between 143961c and e7c37d5.

📒 Files selected for processing (14)
  • .gitignore
  • docs/configuration-reference.yaml
  • docs/design/be/messages-proxy.md
  • internal/config/config_test.go
  • internal/config/defaults.go
  • internal/config/types.go
  • internal/config/yaml_types.go
  • internal/messages/gateway.go
  • internal/messages/gateway_test.go
  • internal/messages/handler.go
  • scripts/tests/generate-code-session-jwt-key_test.sh
  • scripts/tests/generate-upstream-proxy-ca-key_test.sh
  • tests/messages_api_test.go
  • web/src/features/managed-agents/types.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • .gitignore
  • web/src/features/managed-agents/types.ts
  • tests/messages_api_test.go
  • docs/design/be/messages-proxy.md
  • internal/messages/gateway_test.go
  • internal/messages/handler.go
  • internal/messages/gateway.go

- Refactor AgentCreatedFilter into a discriminated union supporting
  custom {from, to} ranges (yyyy-MM-dd).
- Add CreatedFilterDropdown (Popover + react-day-picker range Calendar);
  presets apply immediately, custom range commits on Apply.
- listAgents sends both created_at[gte] and [lte] (backend already parses
  both); client-side filter mirrors the range.
- Add shadcn Calendar plus react-day-picker and date-fns dependencies.
- Update affected filter tests to the new Popover/radio interaction.

Refs superduck-ai#109
响应 superduck-ai#111 review (@jh0904) 的 request changes:

- labels.ts:custom range 解析改用 date-fns parseISO(yyyy-MM-dd 按本地日),
  修复 Date.parse 当 UTC 导致 UTC− 时区标签偏移一天;抽出 locale-aware 的
  formatCreatedRange / formatCreatedRangeDay(基于 Intl.DateTimeFormat),
  trigger 与 draft 共用,中文界面不再固定英文月份
- CreatedFilterDropdown:preset 列表改用项目共享 RadioGroup(@base-ui)+
  Radio.Root,获得方向键选择与 roving tabindex,样式保持整行选项;
  trigger 与 draft label 传 locale
- package.json:移除未使用的 radix-ui 直接依赖并重新生成 bun.lock,
  避免带入整套 @radix-ui/* 元包
- 测试:labels.test.ts 在 TZ=America/Los_Angeles 下覆盖 UTC− 时区 / locale
  / invalid fallback / range 折叠;suite 新增 Custom Range 端到端(Apply 前
  不发请求、Apply 后同时带 created_at[gte]/[lte]、上下界值正确)与 zh-CN
  locale 用例
- docs/design/fe/agents-created-filter.md:补充设计文档(类型/UI/API 边界
  /时区/键盘可达性/测试计划)
- calendar.tsx 的 DayButton ref 按 review 结论保留(与上游 react-day-picker
  默认实现一致)

URL 序列化与刷新恢复按 review 共识拆到 superduck-ai#135 单独跟踪;本 PR 不含。
@Postroggy
Postroggy force-pushed the feat/agents-created-custom-range branch from e7c37d5 to 12e9e39 Compare July 26, 2026 14:11

@duckpr duckpr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DuckPR reviewer: opencode
Model: anthropic/glm-5.2

Important

本次增量提交修改了 Custom Range 测试的 clickDay 选择器,但选择器与 Calendar 组件实际渲染的 data-day 属性既不匹配格式也不匹配结构,会导致 commits a custom created range with inclusive gte/lte bounds 测试在 clickDay(1) 处失败。

Reviewed changes — 本次增量 review 覆盖自上次 Pullfrog review(4566cde)之后的新提交 12e9e39,该提交将 Custom Range 的 API 边界从 UTC 日始 / 日末改为本地日历日日始 / 日末转 UTC。

  • 修正 Custom Range 日期边界语义web/src/features/managed-agents/api.tscreatedFilterRange 改用 date-fns startOfDay(parseISO(filter.from)) / endOfDay(parseISO(filter.to)),将用户本地时区的日始 / 日末转为 UTC,确保过滤范围覆盖界面所选的完整本地日,而非 UTC 日历日。
  • 同步测试断言labels.test.ts 新增 createdFilterRange 单测(TZ=America/Los_Angeles 下验证本地日始转 UTC),并修正 afterAllprocess.env.TZ 的清理(原先未定义时也会写入空值)。
  • 更新 Custom Range 测试选择器与断言ManagedAgentsPage.agents.suite.tsxclickDay 改为按 ISO yyyy-MM-dd 构造选择器并查询 [data-day="..."] button;gte/lte 断言改用本地 new Date(...) 转 ISO。
  • 同步设计文档docs/design/fe/agents-created-filter.md 将 API 边界说明从「UTC 日始 / 日末」改为「本地日历日日始 / 日末转 UTC」。

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using anthropic/glm-5.2𝕏

Comment thread web/src/features/managed-agents/ManagedAgentsPage.agents.suite.tsx Outdated
@Postroggy

Copy link
Copy Markdown
Contributor Author

@jh0904 你在 changes requested 中列出的事项现已全部处理:日期标签与 UTC 边界改为 locale-safe 解析;Custom Range 增加真实交互测试;preset 使用共享 RadioGroup;未使用依赖已移除;设计文档、PR 正文和 #135 的 URL 恢复拆分已同步。刚补的日历定位问题也已修为稳定的 YYYY-MM-DD data-day 合同。当前 139 条 ManagedAgentsPage 测试、build、Prettier、naming、duplicates、complexity 和 CI 均通过,所有 review thread 已 resolve。请方便时重新 review。

@duckpr duckpr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DuckPR reviewer: opencode
Model: anthropic/glm-5.2

✅ No new issues found.

Reviewed changes — 本次增量 review 覆盖自上次 Pullfrog review(12e9e39)之后的新提交 823e14a,该提交将 Calendar 组件的 data-day 属性改为稳定的本地 yyyy-MM-dd,并同步修正测试选择器,解决了上轮 review 指出的选择器与组件属性不匹配问题。

  • 稳定化 data-day 标识web/src/shared/ui/calendar.tsx 新增 calendarDayKey(date) helper,用本地 getFullYear() / getMonth() / getDate() 生成 yyyy-MM-dd,替换原先 locale 相关的 day.date.toLocaleDateString(),使 data-day 不再依赖运行时 locale。
  • 对齐测试选择器ManagedAgentsPage.agents.suite.tsxclickDay 选择器从后代组合 [data-day="..."] button 改为 button[data-day="..."],与 data-day 实际挂在 <Button> 上的 DOM 结构一致;isoDayyyyy-MM-dd 构造与 calendarDayKey 格式完全对齐。

验证:ManagedAgentsPage.test.tsx 139 条测试(含 commits a custom created range with inclusive gte/lte bounds)与 labels.test.ts 10 条测试(TZ=America/Los_Angeles)全绿。

PullfrogView workflow run | Using anthropic/glm-5.2𝕏

Pullfrog  | View workflow run | Using anthropic/glm-5.2𝕏

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.

2 participants