Skip to content

Bounded Pagination in PowerShell Tools for Agents - #470

Draft
tridev-tej wants to merge 4 commits into
PowerShellOrg:mainfrom
tridev-tej:tejesh/powershell-bounded-pagination-blog
Draft

tridev-tej wants to merge 4 commits into
PowerShellOrg:mainfrom
tridev-tej:tejesh/powershell-bounded-pagination-blog

Conversation

@tridev-tej

@tridev-tej tridev-tej commented Oct 26, 2026 •

Copy link
Copy Markdown

Guest article for #451

Shows how to bound paginated API reads by page and item budgets, with explicit completion and error states. Includes a local API and reader covering cyclic cursors, malformed pages and partial results.

@netlify

netlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for powershellorg ready!

Name Link
🔨 Latest commit 14dec9a
🔍 Latest deploy log https://app.netlify.com/projects/powershellorg/deploys/6aea60f38ba8bcfa84f94377
😎 Deploy Preview https://deploy-preview-470--powershellorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@HeyItsGilbert HeyItsGilbert left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's a lot of potential with this article and I think this is a good topic to cover. Please consider tweaking the intro to make it clear what the problem is and why I understanding how to solve it is important.

There's several large files you're asking folks to copy and paste to their machine. If you want to improve the likelihood of them working through this article, you're going to need to document the code a bit more.

There are also several instances of bash mentioned. It's safe to assume the users will have PowerShell available, and by sticking to that over bash you'll have a cross platform article.

Copilot AI 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.

🟡 Changes recommended

The decimal parsing uses the caller’s locale, causing cultures such as fr-FR to abort the adapter and verifier before budget-validation probes run; both calls need InvariantCulture.

1 open issue
What changed in this PR

Adds a guest tutorial for issue #451 showing how PowerShell REST tools can enforce pagination budgets and report complete, partial, or failed results explicitly.

Changes:

  • Defines page and result contracts with request limits, item limits, and cycle detection.
  • Provides a local API, a complete PowerShell reader, and walkthrough examples.
  • Includes verification scripts for boundary cases and failures, plus explanations of the limits these budgets cannot enforce.
File Description
content/​articles/​2026/​10/​bounded-pagination-in-powershell-tools-for-agents/​index.md Adds the bounded-pagination tutorial, runnable examples, and verification harness.

Review effort: Balanced

@tridev-tej
tridev-tej marked this pull request as draft November 3, 2026 14:42
Signed-off-by: Tejesh Vaish <188414140+tridev-tej@users.noreply.github.com>
@tridev-tej

tridev-tej commented Nov 4, 2026 •

Copy link
Copy Markdown
Author

The standalone increment $State.RequestsAttempted++ is ungrouped here, so it emits no extra counter value. In the macOS PowerShell 7.6.9 runs, normal reads ended in Complete/EndOfData; first-request and later 503 failures remained Error/ReadFailed.

With a single-request JSON array, foreach consumes the whole request dictionary here, so the adapter passes the intended request to the reader. Each single-request adapter run returned one correct envelope on the same Mac runtime. Both source lines remain unchanged.

Earlier draft changes:

  • Incomplete inventory opening, with one-page and bounded outputs
  • PowerShell in both terminals, plus the official Node.js installation link
  • Six named files with roles and save instructions for bounded pages
  • Help and examples for ten functions and three entry scripts
  • Both Decimal.Parse calls use InvariantCulture

Earlier walkthrough and help checks covered macOS and Ubuntu. Numeric checks ran under en-US and fr-FR. Windows remains untested.

Copilot AI 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.

🟡 Changes recommended

Two critical active issues remain: a post-increment leaks a truthy pipeline value that can corrupt pagination status, and single-request JSON deserialization can iterate hashtable entries instead of invoking the intended request.

2 open issues
1 resolved since last review

Review effort: Lite

if (-not $State.Seen.Add($State.Cursor)) {
return Set-PageStop $State 'Error' 'RepeatedToken'
}
$State.RequestsAttempted++

$ErrorActionPreference = 'Stop'
. "$PSScriptRoot/Get-BoundedPage.ps1"
$requests = Get-Content -Raw -LiteralPath $RequestFile | ConvertFrom-Json -AsHashtable
@HeyItsGilbert

Copy link
Copy Markdown
Member

This is still set as a draft PR. Are you ready for it to be reviewed? Also check out the copilot comments.

This branch has not been deployed

No deployments
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.

3 participants