fix: hydrate chat files from artifact ledger#4232
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds ChangesCold-start artifact hydration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dcb0a19b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try { | ||
| const raw = await callCoreRpc<AiListArtifactsData>({ | ||
| method: 'openhuman.ai_list_artifacts', | ||
| params: { thread_id: trimmedThreadId, offset: 0, limit: 200 }, |
There was a problem hiding this comment.
Fetch every artifact page before hydrating
When a thread has more than 200 persisted artifacts, this helper only requests the first page and ignores the RPC's total, while ChatFilesChip runs hydration only once per thread change. Ready artifacts beyond the first page are therefore never upserted after a cold Redux load, so the Files panel permanently hides older files in long artifact-heavy chats; please keep paging with increasing offset until all thread artifacts have been considered.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
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 `@app/src/components/chat/ChatFilesChip.tsx`:
- Around line 29-35: Normalize the thread identifier in ChatFilesChip before it
is used with Redux state or actions. The current use of raw threadId in
artifactsByThread lookup and related dispatches can create a separate bucket
from the canonical trimmed ID used by listArtifactsForThread(). Introduce a
single normalized/canonical thread ID in ChatFilesChip and use it consistently
in the useMemo selector, any artifact-related dispatches, and any other
thread-scoped references in this component so all reads and writes hit the same
thread state.
In `@app/src/services/artifactDownloadService.ts`:
- Around line 156-163: Fetch all paginated artifact results before returning
from the artifact download flow. In artifactDownloadService’s list-artifacts
logic, the current call to openhuman.ai_list_artifacts only processes the first
page with a fixed limit, so update this path to loop through subsequent pages
using offset/limit until no more artifacts are returned, then merge and map
through readyListedArtifact before returning the final artifacts array.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a79b29f7-6080-43d5-af1c-a7317cc318b3
📒 Files selected for processing (4)
app/src/components/chat/ChatFilesChip.tsxapp/src/components/chat/__tests__/ChatFilesChip.test.tsxapp/src/services/__tests__/artifactDownloadService.test.tsapp/src/services/artifactDownloadService.ts
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
openhuman.ai_list_artifacts.chatRuntime.artifactsByThread[threadId].Problem
ArtifactMeta.thread_idand added the backendai_list_artifacts({ thread_id })filter, but the chat files UI still only trusted in-memory Redux state.artifactsByThread[threadId]was empty.Solution
listArtifactsForThread(threadId)wraps the Tauri call, normalizes response rows, ignores pending/malformed artifacts, and returns a non-throwing success/failure outcome.ChatFilesChipnow runs the thread-scoped hydration once per thread change and dispatchesupsertArtifactReadyForThreadfor ready artifacts.ChatFilesChipbecause it is the always-mounted owner for this surface;ChatFilesPanelcannot mount when Redux has zero ready files because the chip returnsnull.Submission Checklist
Frontend Checks (quality, i18n, docs, coverage)passed for PR fix: hydrate chat files from artifact ledger #4232.## Related- N/A: no matrix feature row changed.docs/RELEASE-MANUAL-SMOKE.md) - N/A: no release manual smoke surface changed.Closes #NNNin the## RelatedsectionImpact
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
Validation Run
corepack pnpm --dir app exec vitest run --config test/vitest.config.ts src/components/chat/__tests__/ChatFilesChip.test.tsx src/services/__tests__/artifactDownloadService.test.ts --reporter=dotcorepack pnpm --dir app exec eslint src/components/chat/ChatFilesChip.tsx src/components/chat/__tests__/ChatFilesChip.test.tsx src/services/artifactDownloadService.ts src/services/__tests__/artifactDownloadService.test.tscorepack pnpm --dir app exec prettier --check .cargo fmt --manifest-path Cargo.toml --all --checkcargo fmt --manifest-path app/src-tauri/Cargo.toml --all --checkcorepack pnpm --filter openhuman-app compilegit diff --check origin/main..HEADpnpm@10.10.0viacorepack pnpmshim: format check, app lint, Rust check, and command token lint passed.Frontend Checks (quality, i18n, docs, coverage)passed for PR fix: hydrate chat files from artifact ledger #4232.Validation Blocked
command:plainpnpm ...from the Codex runtimeerror:runtimepnpmwas 11.7.0 while the repo pinspnpm@10.10.0; it tried to removenode_modulesnon-interactively and failed withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY.impact:reran validation withcorepack pnpmso the pinned repo package manager was used. The app package still warns that local Node is v22.22.3 while it wants >=24.0.0.command:sandboxedcorepack pnpm --filter openhuman-app test:coverageerror:failed before running tests withlisten EPERM: operation not permitted 127.0.0.1:5005.impact:reran unsandboxed past the listener failure, then stopped the redundant local run after GitHub CI completed the frontend coverage job successfully.Behavior Changes
ai_list_artifacts({ thread_id })after Redux starts empty.Parity Contract
upsertArtifactReadyForThread.Duplicate / Superseded PR Handling
Summary by CodeRabbit