Cap dataset population at 100 rows#111
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR implements a hard 100-row dataset limit across the populate pipeline. The persistence layer ( Sequence Diagram(s)sequenceDiagram
participant PopulateAgent
participant InvestigateTool
participant ConvexInternal
participant DatasetRows
PopulateAgent->>InvestigateTool: run_subagent(request with authorizedDatasetId)
InvestigateTool->>ConvexInternal: internal.datasetRows.countByDataset(authorizedDatasetId)
ConvexInternal->>DatasetRows: count query
DatasetRows-->>ConvexInternal: rowCount
ConvexInternal-->>InvestigateTool: rowCount
alt rowCount >= 100
InvestigateTool-->>PopulateAgent: return { inserted:false, reason: "ROW_LIMIT_REACHED" }
PopulateAgent-->>PopulateAgent: stop dispatching subagents and cease tool calls
else rowCount < 100
InvestigateTool-->>PopulateAgent: proceed (spawn subagent / normal flow)
end
Possibly Related PRs
Suggested Reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@backend/src/mastra/tools/investigate-tool.ts`:
- Around line 88-98: The Convex query that computes rowCount
(convex.query(internal.datasetRows.countByDataset, { datasetId:
authorizedDatasetId })) is executed outside the try/catch in
run_subagent.execute, so move that call inside the existing try block and handle
any rejection by returning the same structured failure object (inserted: false,
reason: ... , row_summary: undefined, clues: undefined) used elsewhere; ensure
you still compare rowCount to MAX_DATASET_ROWS after the query and keep the
query reference to internal.datasetRows.countByDataset and variable name
rowCount unchanged so behavior and messaging remain consistent.
🪄 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: f0a255f0-d3aa-4af2-bc76-42661e82ebc0
📒 Files selected for processing (4)
backend/src/mastra/agents/populate.tsbackend/src/mastra/tools/investigate-tool.tsbackend/src/mastra/workflows/populate.tsfrontend/convex/datasetRows.ts
a6b16c9 to
efb4510
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@backend/src/mastra/workflows/populate.ts`:
- Around line 199-200: The prompt in populate.ts instructs the agent to stop at
100 rows but doesn't tell it what to do when run_subagent returns the tool-level
hard-stop signal; update the prompt used by the logic that calls run_subagent
(referencing run_subagent and the investigate tool) to explicitly mention the
sentinel ROW_LIMIT_REACHED and instruct the agent to immediately cease
dispatching any further subagents or actions when it receives that signal from
run_subagent, and to return/propagate that stop status up the workflow so the
populate run halts at 100 rows.
🪄 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: b4b38ce5-d03a-4c66-9bb1-9dce948f3071
📒 Files selected for processing (4)
backend/src/mastra/agents/populate.tsbackend/src/mastra/tools/investigate-tool.tsbackend/src/mastra/workflows/populate.tsfrontend/convex/datasetRows.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- backend/src/mastra/agents/populate.ts
- backend/src/mastra/tools/investigate-tool.ts
- frontend/convex/datasetRows.ts
Summary
Verification