Skip to content

fix: harden amount sanity checks for CoW order and swap flows#225

Open
twblack88 wants to merge 7 commits into
mainfrom
fix/ss-5630-limit-order-base-units
Open

fix: harden amount sanity checks for CoW order and swap flows#225
twblack88 wants to merge 7 commits into
mainfrom
fix/ss-5630-limit-order-base-units

Conversation

@twblack88
Copy link
Copy Markdown
Contributor

@twblack88 twblack88 commented Apr 22, 2026

Summary

  • harden limit, stop-loss, and TWAP inputs against base-unit style amounts and reduce LLM-visible base-unit leakage in tool outputs
  • add limit-order market sanity checks, including a guard for USD-price-vs-pair-price mixups on crypto-to-crypto pairs
  • improve swap amount safety by adding base-unit input validation and surfacing USD-amount guidance after insufficient-balance checks

Test plan

  • Place ARB -> USDC limit order and confirm human-readable amounts (no base-unit leakage)
  • Verify sub-dollar pair price inversion/USD-price mistakes fail with actionable errors
  • Verify stop-loss and TWAP reject base-unit-like sell amounts
  • Verify large legitimate swaps are not blocked when balance is sufficient
  • Verify insufficient-balance swap errors include USD-flow guidance when amount likely came from USD intent

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Improved error detection and messaging when users input amounts in the wrong format (e.g., USD entered as token amounts instead of token units).
    • Enhanced input validation to reject base-unit values and clarify expected input formats across swap, limit order, stop loss, and TWAP operations.
    • Added sanity checks for limit price calculations to prevent incorrect order configurations.

Review Change Stack

Add base-unit input guards and stronger schema guidance for limit, stop-loss, and TWAP tools, plus LLM-visible output filtering to prevent base-unit field leakage. Also add limit price market-deviation sanity checks to catch inverted or wildly incorrect sub-dollar pricing.

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shapeshift-agentic Ready Ready Preview, Comment Apr 27, 2026 5:13pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b6253d26-d616-49b4-9b40-4a380ba80089

📥 Commits

Reviewing files that changed from the base of the PR and between 9e48a66 and 27d1303.

📒 Files selected for processing (4)
  • .gitignore
  • apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
  • apps/agentic-server/src/tools/stopLoss/createStopLoss.ts
  • apps/agentic-server/src/tools/twap/createTwap.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/agentic-server/src/tools/twap/createTwap.ts
  • apps/agentic-server/src/tools/stopLoss/createStopLoss.ts
  • apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts

📝 Walkthrough

Walkthrough

This PR strengthens agentic tool input validation across swap and order tools by adding Zod schema refinements that reject base-unit-like amounts, implements USD price sanity checks for limit orders, and adds tool result serialization for LLM visibility. A gitignore entry for Nx cache is also included.

Changes

Agentic Tool Input Validation & LLM Result Visibility

Layer / File(s) Summary
Limit Order USD price sanity check
apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
Imports getSimplePrices, adds .refine() to reject 15+ digit base-unit inputs in sellAmount schema, updates descriptions for sellAmount and limitPrice to forbid base units and clarify pair-rate semantics, and implements runtime validation in executeCreateLimitOrder that fetches USD prices, computes implied pair market rate, and rejects inverted or USD-price-like limitPrice values with warnings.
Limit Order LLM result visibility
apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
Adds experimental_toToolResultContent to createLimitOrderTool to serialize CreateLimitOrderOutput for LLM visibility, omitting orderParams and limiting signingData fields.
Stop Loss & TWAP input validation with LLM result visibility
apps/agentic-server/src/tools/stopLoss/createStopLoss.ts, apps/agentic-server/src/tools/twap/createTwap.ts
Applies .refine() to reject 15+ digit base-unit-like values in createStopLossSchema.sellAmount and createTwapSchema.totalAmount with expanded descriptions warning against base units; adds experimental_toToolResultContent to both createStopLossTool and createTwapTool to return LLM-visible JSON while filtering internal precision and base-unit fields.

Build Infrastructure

Layer / File(s) Summary
Nx cache directory ignore
.gitignore
Adds .nx/ to gitignore with a "Nx local cache (never commit)" comment section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A hunch and a heuristic saved the day,
When USD masqueraded as token, we'd say:
"Base units of fifteen digits, be gone!
Schema now guards what the user inputs upon!"
The LLM sees clearly, no secrets we hide. 🌕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'fix: harden amount sanity checks for CoW order and swap flows' directly and accurately summarizes the main change: strengthening validation for amount inputs across swap, limit order, stop-loss, and TWAP tools to prevent base-unit mistakes and improve safety.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ss-5630-limit-order-base-units

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 and usage tips.

@twblack88
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

♻️ Duplicate comments (7)
.nx/cache/terminalOutputs/13554052336615392278.commit (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This is a build cache artifact that should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/13554052336615392278.commit at line 1, The
committed Nx cache artifact
".nx/cache/terminalOutputs/13554052336615392278.commit" must be removed from the
repo and prevented from recurring: delete that file from the commit (or run git
rm --cached on it) and add a rule to ignore Nx cache files (e.g., add ".nx/" or
".nx/cache/" to .gitignore) so future cache artifacts are not tracked; ensure
the commit no longer contains the file before pushing.
.nx/cache/terminalOutputs/3221835782562372545 (1)

1-2: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This cached terminal output should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/3221835782562372545 around lines 1 - 2, Remove the
Nx cache file from the repository and ensure Nx cache is ignored: delete the
committed file entry (e.g., .nx/cache/terminalOutputs/3221835782562372545) from
the repo and commit that removal (use git rm --cached or equivalent), then add
the .nx/ directory or specifically .nx/cache/ to .gitignore so future cached
terminal outputs are not committed; verify by running git status to confirm the
file is no longer tracked.
.nx/cache/terminalOutputs/14206404844807895703 (1)

1-2: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This cached terminal output should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/14206404844807895703 around lines 1 - 2, Remove
the committed Nx cache file and ensure Nx cache is ignored: delete the file
(.nx/cache/terminalOutputs/14206404844807895703) from the repository, run git rm
--cached on it, and commit the removal; then add .nx/ (or at minimum .nx/cache/)
to .gitignore so future tsc --build outputs are not committed; finally verify no
other files under .nx/ are tracked and update the commit.
.nx/cache/terminalOutputs/3221835782562372545.commit (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This is a build cache artifact that should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/3221835782562372545.commit at line 1, A Nx build
cache artifact (terminalOutputs/*.commit) was committed; remove the file from
the repo and prevent future commits by adding the Nx cache pattern to .gitignore
and removing the file from Git's index: remove the specific committed file
(unstage/remove from commit), add "terminalOutputs/*.commit" or ".nx/cache/"
patterns to .gitignore, commit the .gitignore change, and ensure no other Nx
cache files remain staged; reference the committed artifact pattern
"terminalOutputs/*.commit" when locating the offending file.
.nx/cache/13554052336615392278.commit (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This is a build cache artifact that should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/13554052336615392278.commit at line 1, Remove the committed Nx
cache artifact and prevent future commits: delete the cache file (.nx/cache/...
.commit) from the repo, add the appropriate Nx cache patterns (e.g., .nx/ and/or
.nx/cache/) to .gitignore if not already present, and create a lightweight
commit that removes the file. Also ensure no CI step or script re-adds .nx cache
files to source control.
.nx/cache/terminalOutputs/14206404844807895703.commit (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This is a build cache artifact that should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/14206404844807895703.commit at line 1, Remove the
committed Nx build cache artifact from version control and stop tracking it:
remove the cached file from the index (git rm --cached) and commit that removal,
then add a .gitignore entry to ignore the Nx cache directory (e.g., the Nx cache
pattern) so it won’t be re-added; finally, ensure the cleanup commit is pushed
so CI and other collaborators no longer receive this build-cache artifact.
.nx/cache/terminalOutputs/17428515039638435960.commit (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Do not commit Nx cache files.

This is a build cache artifact that should be excluded from version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/terminalOutputs/17428515039638435960.commit at line 1, The commit
contains an Nx build-cache artifact (file 17428515039638435960.commit) that must
be removed from version control; remove that file from the repository index (so
it’s no longer tracked), commit the removal, and add the Nx cache
directory/pattern to .gitignore so future cache files are not committed; finally
verify the change by committing the updated .gitignore and confirming the cache
file is absent from the repo and PR.
🧹 Nitpick comments (6)
.nx/cache/3221835782562372545.commit (1)

1-1: Remove Nx cache artifact from version control

This file looks like a generated local cache marker and should not be committed. Please remove .nx/cache/** tracked artifacts from the PR and ensure they’re ignored to avoid noisy diffs and merge churn.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/3221835782562372545.commit at line 1, Remove the generated Nx
cache artifact ".nx/cache/3221835782562372545.commit" from the commit and stop
tracking the .nx cache directory: delete the file from the repo index (git rm
--cached) so it’s removed from the PR, add the pattern ".nx/cache/**" to
.gitignore (or ensure existing ignore covers it), and commit the .gitignore
change so future cache files under .nx/cache are not tracked.
.nx/cache/7460006978003770812.commit (1)

1-1: Remove committed Nx cache artifact from source control.

Line 1 is a local cache marker (true) under .nx/cache, which should not be versioned in normal workflows. Please remove this file from the PR and ensure .nx/cache/ is gitignored to avoid noisy, non-functional diffs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/7460006978003770812.commit at line 1, Remove the committed Nx
cache artifact `.nx/cache/7460006978003770812.commit` from the PR by deleting
that file from the repository and removing it from the index (git rm --cached or
git rm), then ensure the `.nx/cache/` directory is listed in .gitignore so
future cache files are not committed; verify with git status and amend the
commit or create a follow-up commit that removes the file and adds `.nx/cache/`
to .gitignore.
.nx/cache/14206404844807895703.commit (1)

1-1: Exclude Nx cache artifacts from source control.

This file is a generated local cache marker and should not be committed. Keeping .nx/cache/** in git introduces noisy diffs and non-deterministic repository state. Please remove this artifact and ignore the cache directory.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/cache/14206404844807895703.commit at line 1, Remove the generated Nx
cache marker file that was accidentally committed (the local cache artifact) and
stop tracking it: delete the committed cache artifact from the repository and
commit that deletion, and update the project ignore rules to add the Nx cache
directory pattern so it isn't re-committed (add the appropriate .nx cache
pattern to .gitignore or the repo's ignore file and commit that change). Ensure
you remove the file from git history/tracking (e.g., git rm or git rm --cached)
so future commits won't include the generated cache artifact.
.nx/workspace-data/tsconfig-files.hash (1)

1-1: Avoid committing Nx workspace cache artifacts

This file is generated local cache metadata and is unrelated to the functional changes in this PR. Keeping it in VCS increases noise and merge-conflict risk; please remove it from the PR and ensure .nx/workspace-data/** is gitignored (if not intentionally tracked).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/workspace-data/tsconfig-files.hash at line 1, The PR includes a
generated Nx workspace cache file that should not be committed; remove that file
from the commit (unstage and delete from the repo history if needed) and add a
gitignore rule to ignore the Nx workspace cache directory (add a pattern such as
.nx/workspace-data/** to .gitignore), then commit the .gitignore change and a
new commit that removes the cached file (use git rm --cached <file> if you want
to keep it locally) so the generated artifact is no longer tracked.
.nx/workspace-data/lockfile.hash (1)

1-1: Avoid committing Nx workspace cache hash artifacts.

Line 1 appears to be machine-generated workspace metadata (.nx/workspace-data/*). Tracking this in git usually causes noisy diffs and frequent conflicts without runtime benefit. Please remove it from version control and ensure this path is gitignored unless your repo intentionally versions Nx cache state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.nx/workspace-data/lockfile.hash at line 1, Remove the generated workspace
cache artifact lockfile.hash from version control and stop tracking future
changes: delete the tracked file (git rm --cached lockfile.hash or git rm
--cached .nx/workspace-data/lockfile.hash), add the workspace cache pattern to
.gitignore (e.g., ignore .nx/workspace-data/ or lockfile.hash) and commit that
change so the file is not committed again; if the repository intentionally
versions Nx cache state, instead document that decision in the repo README or CI
settings.
apps/agentic-server/src/tools/initiateSwap.ts (1)

299-305: Optional: consider tightening the 15-digit heuristic for ultra-high-supply tokens.

/^\d{15,}/ (no end anchor, no decimal point in the run) cleanly rejects base-unit integers while allowing fractional inputs. However, it will also reject legitimate integer amounts for ultra-high-supply memecoins (e.g., selling 1000000000000000 SHIB/PEPE/BONK = 1 quadrillion units is 16 digits but plausible as a human-readable amount). If that user flow matters, consider gating the rule on the asset's precision (e.g., only treat the input as base-unit-like when digit count ≥ precision), since the real failure mode is users pasting a value already scaled by 10**precision. Same pattern is duplicated across createLimitOrder.ts, createStopLoss.ts, and createTwap.ts — a shared helper would keep the behavior consistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/agentic-server/src/tools/initiateSwap.ts` around lines 299 - 305, The
/^\d{15,}/ heuristic in the sellAmount Zod refine (seen in initiateSwap.ts) can
false-positive for ultra-high-supply tokens; replace it with a precision-aware
check: fetch the asset's precision where sellAmount is validated (or accept a
precision parameter), strip whitespace, allow decimal points, and treat the
value as "base-unit-like" only when the integer digit count (digits before the
decimal) is >= precision (or a configured threshold), then fail with the same
message; extract this logic into a shared helper (used by createLimitOrder.ts,
createStopLoss.ts, createTwap.ts) so all validators call a function like
isBaseUnitLike(value, precision) instead of the hardcoded /^\d{15,}/ test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.nx/cache/17428515039638435960.commit:
- Line 1: Add an entry to the repository .gitignore to exclude Nx cache
artifacts by adding a line for ".nx/cache/" (or equivalent pattern like
".nx/cache/*") so .nx/cache/*.commit and related files are not tracked; update
the .gitignore file, commit that change, and then ensure any existing cached
files are removed from the index (git rm --cached) so future commits do not
include .nx/cache artifacts.

In @.nx/cache/cloud/2506.06.6.hotfix1/static/login-end.html:
- Around line 1-414: This PR accidentally includes generated Nx cache artifacts
under .nx/cache (example file shown), so remove the entire .nx/cache tree from
the commit and stop tracking it: remove those files from the branch
(unstage/delete them from VCS), add .nx/cache and .nx/workspace-data to
.gitignore, amend the commit (or create a new commit) and push the branch; do
not attempt to modify the upstream-generated HTML (it contains duplicate SVG ids
like nx-cloud-header-logo and nx-cloud-header-logo-stroke-1 which are
third-party artifacts and should be left unchanged).

In @.nx/cache/terminalOutputs/13554052336615392278:
- Around line 1-2: Remove the machine-local Nx cache/workspace metadata from the
PR and prevent future commits by adding ".nx/cache/" and ".nx/workspace-data/"
to .gitignore, then untrack the currently committed artifacts using git rm -r
--cached .nx/cache .nx/workspace-data and commit that removal; target the
offending entries shown in the diff (the .nx/cache terminalOutputs files) and
ensure both .nx/cache and .nx/workspace-data are ignored per Nx recommendation.

In @.nx/cache/terminalOutputs/1666183885798920482:
- Around line 1-167: The commit includes generated Nx terminal cache output
(.nx/cache/terminalOutputs/1666183885798920482) which should be removed; remove
that file from the commit (git rm --cached or delete and stage the deletion) and
amend the commit, then add the folder pattern ".nx/cache/terminalOutputs/" (or
".nx/cache/") to .gitignore so future generated logs are not tracked; ensure you
also run git add .gitignore and commit the ignore change and verify no other
cached terminalOutputs files remain tracked.

In @.nx/cache/terminalOutputs/7460006978003770812.commit:
- Line 1: Add an entry for the Nx build cache to .gitignore to prevent
machine-specific cache files from being committed; specifically add ".nx/cache/"
(or ".nx/cache" with a trailing slash) to the repository .gitignore, commit that
change, and then unstage/remove any existing .nx/cache artifacts from the index
so future commits do not include them.

In @.nx/workspace-data/react-router-8507840353650169656.hash:
- Line 1: The repository accidentally committed Nx cache artifacts (e.g., the
.nx workspace data file); update the .gitignore to exclude Nx caches by adding
an entry for ".nx/" and then finalize removal of the cached files by ensuring
the staged `git rm` is committed; specifically modify the .gitignore to include
the line ".nx/" and commit that change alongside the already staged removals so
future Nx cache files (like react-router-*.hash) are not tracked.

In `@apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts`:
- Around line 101-147: The limitPrice finite/positive validation is currently
inside the market-price block so it can be skipped when getSimplePrices returns
zeros; move the basic check for Number.isFinite(limitPriceNum) and limitPriceNum
> 0 (using input.limitPrice / limitPriceNum) to run before calling
getSimplePrices and before any call to calculateBuyAmount/toBaseUnit, throwing
the same Error when invalid; keep the more detailed market-comparison logic
(ratio, logRatio, USD-guard) inside the existing sellUsdPrice/buyUsdPrice
conditional.
- Around line 254-257: The experimental_toToolResultContent in createLimitOrder
currently removes orderParams but still returns signingData (type
CowOrderSigningData) which contains a message: CowOrderQuote with base-unit
sellAmount/buyAmount; update experimental_toToolResultContent to sanitize
signingData by removing or omitting the message field (e.g., create a shallow
copy of result.signingData without message) before JSON.stringify so base-unit
amounts are not returned to the LLM — touch the experimental_toToolResultContent
function and the CreateLimitOrderOutput handling to mirror the filtering used in
createTwap/createStopLoss.

---

Duplicate comments:
In @.nx/cache/13554052336615392278.commit:
- Line 1: Remove the committed Nx cache artifact and prevent future commits:
delete the cache file (.nx/cache/... .commit) from the repo, add the appropriate
Nx cache patterns (e.g., .nx/ and/or .nx/cache/) to .gitignore if not already
present, and create a lightweight commit that removes the file. Also ensure no
CI step or script re-adds .nx cache files to source control.

In @.nx/cache/terminalOutputs/13554052336615392278.commit:
- Line 1: The committed Nx cache artifact
".nx/cache/terminalOutputs/13554052336615392278.commit" must be removed from the
repo and prevented from recurring: delete that file from the commit (or run git
rm --cached on it) and add a rule to ignore Nx cache files (e.g., add ".nx/" or
".nx/cache/" to .gitignore) so future cache artifacts are not tracked; ensure
the commit no longer contains the file before pushing.

In @.nx/cache/terminalOutputs/14206404844807895703:
- Around line 1-2: Remove the committed Nx cache file and ensure Nx cache is
ignored: delete the file (.nx/cache/terminalOutputs/14206404844807895703) from
the repository, run git rm --cached on it, and commit the removal; then add .nx/
(or at minimum .nx/cache/) to .gitignore so future tsc --build outputs are not
committed; finally verify no other files under .nx/ are tracked and update the
commit.

In @.nx/cache/terminalOutputs/14206404844807895703.commit:
- Line 1: Remove the committed Nx build cache artifact from version control and
stop tracking it: remove the cached file from the index (git rm --cached) and
commit that removal, then add a .gitignore entry to ignore the Nx cache
directory (e.g., the Nx cache pattern) so it won’t be re-added; finally, ensure
the cleanup commit is pushed so CI and other collaborators no longer receive
this build-cache artifact.

In @.nx/cache/terminalOutputs/17428515039638435960.commit:
- Line 1: The commit contains an Nx build-cache artifact (file
17428515039638435960.commit) that must be removed from version control; remove
that file from the repository index (so it’s no longer tracked), commit the
removal, and add the Nx cache directory/pattern to .gitignore so future cache
files are not committed; finally verify the change by committing the updated
.gitignore and confirming the cache file is absent from the repo and PR.

In @.nx/cache/terminalOutputs/3221835782562372545:
- Around line 1-2: Remove the Nx cache file from the repository and ensure Nx
cache is ignored: delete the committed file entry (e.g.,
.nx/cache/terminalOutputs/3221835782562372545) from the repo and commit that
removal (use git rm --cached or equivalent), then add the .nx/ directory or
specifically .nx/cache/ to .gitignore so future cached terminal outputs are not
committed; verify by running git status to confirm the file is no longer
tracked.

In @.nx/cache/terminalOutputs/3221835782562372545.commit:
- Line 1: A Nx build cache artifact (terminalOutputs/*.commit) was committed;
remove the file from the repo and prevent future commits by adding the Nx cache
pattern to .gitignore and removing the file from Git's index: remove the
specific committed file (unstage/remove from commit), add
"terminalOutputs/*.commit" or ".nx/cache/" patterns to .gitignore, commit the
.gitignore change, and ensure no other Nx cache files remain staged; reference
the committed artifact pattern "terminalOutputs/*.commit" when locating the
offending file.

---

Nitpick comments:
In @.nx/cache/14206404844807895703.commit:
- Line 1: Remove the generated Nx cache marker file that was accidentally
committed (the local cache artifact) and stop tracking it: delete the committed
cache artifact from the repository and commit that deletion, and update the
project ignore rules to add the Nx cache directory pattern so it isn't
re-committed (add the appropriate .nx cache pattern to .gitignore or the repo's
ignore file and commit that change). Ensure you remove the file from git
history/tracking (e.g., git rm or git rm --cached) so future commits won't
include the generated cache artifact.

In @.nx/cache/3221835782562372545.commit:
- Line 1: Remove the generated Nx cache artifact
".nx/cache/3221835782562372545.commit" from the commit and stop tracking the .nx
cache directory: delete the file from the repo index (git rm --cached) so it’s
removed from the PR, add the pattern ".nx/cache/**" to .gitignore (or ensure
existing ignore covers it), and commit the .gitignore change so future cache
files under .nx/cache are not tracked.

In @.nx/cache/7460006978003770812.commit:
- Line 1: Remove the committed Nx cache artifact
`.nx/cache/7460006978003770812.commit` from the PR by deleting that file from
the repository and removing it from the index (git rm --cached or git rm), then
ensure the `.nx/cache/` directory is listed in .gitignore so future cache files
are not committed; verify with git status and amend the commit or create a
follow-up commit that removes the file and adds `.nx/cache/` to .gitignore.

In @.nx/workspace-data/lockfile.hash:
- Line 1: Remove the generated workspace cache artifact lockfile.hash from
version control and stop tracking future changes: delete the tracked file (git
rm --cached lockfile.hash or git rm --cached .nx/workspace-data/lockfile.hash),
add the workspace cache pattern to .gitignore (e.g., ignore .nx/workspace-data/
or lockfile.hash) and commit that change so the file is not committed again; if
the repository intentionally versions Nx cache state, instead document that
decision in the repo README or CI settings.

In @.nx/workspace-data/tsconfig-files.hash:
- Line 1: The PR includes a generated Nx workspace cache file that should not be
committed; remove that file from the commit (unstage and delete from the repo
history if needed) and add a gitignore rule to ignore the Nx workspace cache
directory (add a pattern such as .nx/workspace-data/** to .gitignore), then
commit the .gitignore change and a new commit that removes the cached file (use
git rm --cached <file> if you want to keep it locally) so the generated artifact
is no longer tracked.

In `@apps/agentic-server/src/tools/initiateSwap.ts`:
- Around line 299-305: The /^\d{15,}/ heuristic in the sellAmount Zod refine
(seen in initiateSwap.ts) can false-positive for ultra-high-supply tokens;
replace it with a precision-aware check: fetch the asset's precision where
sellAmount is validated (or accept a precision parameter), strip whitespace,
allow decimal points, and treat the value as "base-unit-like" only when the
integer digit count (digits before the decimal) is >= precision (or a configured
threshold), then fail with the same message; extract this logic into a shared
helper (used by createLimitOrder.ts, createStopLoss.ts, createTwap.ts) so all
validators call a function like isBaseUnitLike(value, precision) instead of the
hardcoded /^\d{15,}/ test.
🪄 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: d840ecca-e7b1-425b-be2f-1d23cb996c2e

📥 Commits

Reviewing files that changed from the base of the PR and between 113fed0 and 9e48a66.

⛔ Files ignored due to path filters (14)
  • .nx/cache/12786974370515813638-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/12786974370515813638.tar.gz is excluded by !**/*.gz
  • .nx/cache/16223358955046570561-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/16223358955046570561.tar.gz is excluded by !**/*.gz
  • .nx/cache/16635151379768794721-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/16635151379768794721.tar.gz is excluded by !**/*.gz
  • .nx/cache/1666183885798920482-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/1666183885798920482.tar.gz is excluded by !**/*.gz
  • .nx/cache/16785014982916244893-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/16785014982916244893.tar.gz is excluded by !**/*.gz
  • .nx/cache/8707572495919475997-logs.tar.gz is excluded by !**/*.gz
  • .nx/cache/8707572495919475997.tar.gz is excluded by !**/*.gz
  • .nx/cache/cloud/verify.lock is excluded by !**/*.lock
  • .nx/workspace-data/d/daemon.log is excluded by !**/*.log
📒 Files selected for processing (39)
  • .env
  • .nx/cache/13554052336615392278.commit
  • .nx/cache/14206404844807895703.commit
  • .nx/cache/17428515039638435960.commit
  • .nx/cache/3221835782562372545.commit
  • .nx/cache/7460006978003770812.commit
  • .nx/cache/cloud/2506.06.6.hotfix1/index.js
  • .nx/cache/cloud/2506.06.6.hotfix1/lib/daemon/process-run-end.js
  • .nx/cache/cloud/2506.06.6.hotfix1/lib/heartbeat/heartbeat-process.js
  • .nx/cache/cloud/2506.06.6.hotfix1/package.json
  • .nx/cache/cloud/2506.06.6.hotfix1/static/login-end.html
  • .nx/cache/cloud/2506.06.6.hotfix1/static/login-start.html
  • .nx/cache/run.json
  • .nx/cache/terminalOutputs/13554052336615392278
  • .nx/cache/terminalOutputs/13554052336615392278.commit
  • .nx/cache/terminalOutputs/14206404844807895703
  • .nx/cache/terminalOutputs/14206404844807895703.commit
  • .nx/cache/terminalOutputs/1666183885798920482
  • .nx/cache/terminalOutputs/17428515039638435960.commit
  • .nx/cache/terminalOutputs/3221835782562372545
  • .nx/cache/terminalOutputs/3221835782562372545.commit
  • .nx/cache/terminalOutputs/7460006978003770812.commit
  • .nx/workspace-data/eslint-2654242865465226088.hash
  • .nx/workspace-data/file-map.json
  • .nx/workspace-data/lockfile.hash
  • .nx/workspace-data/nx_files.nxt
  • .nx/workspace-data/parsed-lock-file.json
  • .nx/workspace-data/playwright-5186013267177752385.hash
  • .nx/workspace-data/project-graph.json
  • .nx/workspace-data/react-router-8507840353650169656.hash
  • .nx/workspace-data/source-maps.json
  • .nx/workspace-data/tsc-2568428459166798129.hash
  • .nx/workspace-data/tsconfig-files.hash
  • .nx/workspace-data/vite-9347777721732807074.hash
  • .vscode/settings.json
  • apps/agentic-server/src/tools/initiateSwap.ts
  • apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
  • apps/agentic-server/src/tools/stopLoss/createStopLoss.ts
  • apps/agentic-server/src/tools/twap/createTwap.ts
💤 Files with no reviewable changes (1)
  • .env

Comment thread .nx/cache/17428515039638435960.commit Outdated
Comment thread .nx/cache/cloud/2506.06.6.hotfix1/static/login-end.html Outdated
Comment thread .nx/cache/terminalOutputs/13554052336615392278 Outdated
Comment thread .nx/cache/terminalOutputs/1666183885798920482 Outdated
Comment thread .nx/cache/terminalOutputs/7460006978003770812.commit Outdated
Comment thread .nx/workspace-data/react-router-8507840353650169656.hash Outdated
Comment thread apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
Comment thread apps/agentic-server/src/tools/limitOrder/createLimitOrder.ts
Prevent committing local Nx cache files to the repository so you don't end up with spew.
@twblack88 twblack88 marked this pull request as ready for review May 29, 2026 05:11
@twblack88 twblack88 requested a review from 0xApotheosis May 29, 2026 05:11
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.

1 participant