GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(agiloft): repoint the block at the alrest surface and fix EWLogin by waleedlatif1 · Pull Request #6562 · simstudioai/sim

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Customer report: the native Agiloft block cannot authenticate against any instance. Production traces for their workspace confirm every failure mode verbatim, so this is fixed against real evidence rather than inference.

  • EWLogin was missing required parameters. It sent $KB/$login/$password as query params; the live server answers 400 EWWrongDataException ... One has to specify $table, $KB, $lang parameters. $table is required even though only $KB/$login/$password/$lang are documented. Parameters now go in a form-encoded body — Agiloft's docs allow it, and it keeps the password out of URLs and access logs.
  • Wrong API surface. Because login always failed, no data call was ever reached, which hid that record operations were pointed at a surface that cannot use the token EWLogin issues. /ewws/EW* authenticates from inline $login/$password and rejects a bearer token; /ewws/alrest/{KB} accepts it. Create, read, update, delete, search, and attachment retrieval now go through alrest.
  • success: false on HTTP 200. alrest reports failures with a 200 and {"success": false, "errors":[...]}. readAlrestJson is now the only sanctioned reader; checking response.ok alone turned refusals into successful empty results.
  • Auth scheme trailing space. Agiloft returns "authentication_scheme": "Bearer ". It's read from the response and trimmed rather than hardcoded or concatenated blind.
  • Optional inputs rejecting null. A blank Page field resolved to null and failed validation with expected string, received null before any HTTP call. Optional string params now accept null.
  • 184KB records. Reads with a named field list go through the search projection, the only route that accepts a field array.

Operations with no documented alrest equivalent (select, attachment info/attach/remove, lock, choice-line-id, action button) stay on /ewws/EW* but now authenticate inline instead of sending a token that surface rejects.

Type of Change

  • Bug fix

Testing

39 unit tests. Each fix was reverted once to confirm its assertions go red. type-check, lint, tool-metadata:check, integration-catalog:check, check:api-validation all pass.

Evidence base: production trace spans for the reporting workspace contain both the verbatim login refusal and a working customer-built tool using the alrest recipe, which is what the alrest paths and envelope handling are modelled on.

Not verified against a live instance. The EW*-only operations listed above are the weakest part — inline-credential auth there is documented but untested, and their alrest equivalents are unknown. Worth a smoke test against a real KB before relying on them.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@vercel

vercel Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 11, 2026 11:27pm

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gitguardian

gitguardian Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 21:42 Inactive
@cursor

cursor Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR Summary

High Risk
Touches authentication, credential transport, and write paths across the Agiloft integration. Legacy EW* inline-credential auth is documented but not verified against a live instance.

Overview
Restores the Agiloft block after production auth failures. EWLogin now sends $KB/$table/$lang/credentials in a form body (the live server requires $table), and trims Agiloft's trailing-space Bearer scheme.

Record create/read/update/delete/search move to /ewws/alrest/{KB} with bearer tokens. Legacy /ewws/EW* ops (select, attach/retrieve/remove, lock, choice ID, action button, upsert, async status) authenticate with inline credentials instead of a rejected bearer token. readAlrestJson treats HTTP 200 + success: false as a refusal, and refusals return settled failures rather than retryable 500s.

Adds List Tables, Upsert, Natural Language Search, Async Status, and a working Saved Search. Field-projected reads go through search to avoid ~184KB full records; search/select results are capped with a truncated flag. Optional blank inputs no longer fail validation as null.

Reviewed by Cursor Bugbot for commit 0aba13d. Configure here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR repairs Agiloft authentication and redirects compatible record operations to the token-authenticated alrest API while retaining inline credentials for legacy EW-only operations.

  • Adds centralized handling for alrest success and failure envelopes.
  • Updates record CRUD, search, attachment, metadata, async, and related tool contracts.
  • Adds validation and identity checks for projected record reads.
  • Expands tests, generated tool metadata, integration documentation, and the local Agiloft specification.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; both previously reported projected-read identity issues are fixed by numeric input validation and canonical numeric result matching.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/agiloft/read_record/route.ts Projected reads now reject non-numeric IDs, query through alrest search, and select results by numeric ID equivalence.
apps/sim/tools/agiloft/utils.server.ts Centralizes pinned-IP Agiloft login, alrest envelope parsing, legacy request execution, and logout behavior.
apps/sim/tools/agiloft/utils.ts Adds URL builders, optional-input normalization, error extraction, and shared Agiloft response utilities.
apps/sim/lib/api/contracts/tools/agiloft.ts Updates Agiloft request and response contracts for nullable optional inputs and newly supported operations.
apps/sim/blocks/blocks/agiloft.ts Repoints the native block at the updated Agiloft tool catalog and operation schemas.
apps/sim/app/api/tools/agiloft/create_record/route.test.ts Adds broad coverage for login parameters, alrest envelopes, projections, result ceilings, and projected-read identity safeguards.

Sequence Diagram

sequenceDiagram
  participant Workflow
  participant Sim as Agiloft Tool Route
  participant Login as EWLogin
  participant Alrest as alrest API
  participant Legacy as EW Legacy API

  Workflow->>Sim: Invoke Agiloft operation
  alt alrest-compatible operation
    Sim->>Login: POST form credentials and required context
    Login-->>Sim: Token and authentication scheme
    Sim->>Alrest: Request with authorization token
    Alrest-->>Sim: success/result or success:false/errors
    Sim-->>Workflow: Normalized tool result
  else EW-only operation
    Sim->>Legacy: Request with inline credentials
    Legacy-->>Sim: EWREST or operation-specific response
    Sim-->>Workflow: Parsed tool result
  end
Loading

Reviews (7): Last reviewed commit: "fix(agiloft): stop retrying refusals, an..." | Re-trigger Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/app/api/tools/agiloft/read_record/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/app/api/tools/agiloft/attach/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/app/api/tools/agiloft/create_record/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 21:47 Inactive
@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 21:53 Inactive
@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 21:57 Inactive
@waleedlatif1
waleedlatif1 force-pushed the fix/agiloft-alrest-auth branch from a6f0e38 to 88935c0 Compare August 11, 2026 21:59
@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 21:59 Inactive
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 22:10 Inactive
cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/tools/agiloft/utils.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview August 11, 2026 22:33
View deployment
@vercel
vercel Bot deployed to Preview August 11, 2026 22:40
View deployment
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/tools/agiloft/utils.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/app/api/tools/agiloft/attach/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/tools/agiloft/utils.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview August 11, 2026 22:54
View deployment
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/app/api/tools/agiloft/read_record/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/tools/agiloft/utils.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/api/contracts/tools/agiloft.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/blocks/blocks/agiloft.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/app/api/tools/agiloft/upsert_record/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview August 11, 2026 23:05
View deployment
@waleedlatif1
waleedlatif1 force-pushed the fix/agiloft-alrest-auth branch from 2a60bca to 852b01c Compare August 11, 2026 23:10
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview August 11, 2026 23:15
View deployment
cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes
Comment thread apps/sim/blocks/blocks/agiloft.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/blocks/blocks/agiloft.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 23:21 Inactive
waleedlatif1 added 2 commits August 11, 2026 16:21
@waleedlatif1
fix(agiloft): make the block work, and align it with the REST documen…
a776182
…tation

The native Agiloft block could not authenticate against any instance. A
customer reported it; production traces for their workspace confirm every
failure mode verbatim. Fixing that exposed a second, larger problem, and a
per-endpoint audit against the full published documentation found the rest.

Authentication
- EWLogin sent only $KB/$login/$password as query parameters. A live instance
  answers `400 EWWrongDataException ... One has to specify $table, $KB, $lang
  parameters`. $table is required even though only $KB/$login/$password/$lang
  are documented. Parameters now travel in a form-encoded body, which the docs
  permit and which keeps the password out of URLs and access logs.
- The authentication scheme is read from the login response and trimmed;
  Agiloft returns it as "Bearer " with a trailing space.
- EWLogout was missing $lang.

Surfaces
- Record create, read, update, search and saved-search now use the endpoints
  that accept the token EWLogin issues; the legacy operations authenticate from
  inline credentials, which is what that surface expects. Nothing sends both
  forms at once — the documented 400 for doing so is what the original report
  had run into.
- EWSelect passes credentials in a POST body, one of the five operations
  documented to support it.
- Attachment retrieval uses the documented EWRetrieve endpoint, with
  filePosition rather than position, and no longer needs a login/logout pair.

Defects found in the audit
- remove_attachment reported zero on every call: its body is the EWREST
  assignment form but the route ran JSON.parse then Number(), yielding NaN.
- The EWREST parser could not read EWActionButton's documented response, which
  puts both assignments on one line.
- EWLock treated any 200 as success, including the documented
  {error, error_description} envelope, and invented an 'UNKNOWN' status.
- EWTable discarded the linked-field details, required flag and text field type
  it had asked for, making includeLinkedInfo inert.
- select_records had no result ceiling at all; both it and search now cap and
  report a truncated flag rather than reporting a capped length as a total.
- Optional string inputs rejected null, so a blank Page field failed validation
  before any request was made.
- Upsert treated the documented 202 async acknowledgement as a missing-ID
  failure, and returned no callback ID for the caller to poll.
- Every response contract required an output that the 401 and 500 paths never
  return.

Coverage added
- Table and field discovery (EWTable), upsert (EWUpsert), async status
  (EWAsyncStatus), natural language search (EWNLPSearch), action buttons
  (EWActionButton), the REPLACE_WITH_ANOTHER delete rule with its substitute
  records, $async on upsert, and <fieldName>$overwrite on attach.
- Reads with a named field list go through the search projection; an unfiltered
  contract record runs to roughly 184KB and swamps downstream agent context.
- Errors are readable: Agiloft wraps failures in HTML around a typed exception
  and an internal task id, and the JSON endpoints now request real status codes
  rather than a 200 the caller has to interpret.

Not implemented: $searchSQL and $operationHints=NOLOCK are EWRead/EWUpdate
parameters and those operations do not run on that surface here; EWQuestion,
EWHotlinks, EWOData, EWBroadcast and webhook registration have no documentation
beyond their names.

Verified against the published documentation, not against a live instance.
@waleedlatif1
fix(agiloft): give natural language search a sentence that paints
be5d283
check:canvas-sentences failed: the nlp_search card resolved to nothing on an
untouched canvas, so it painted empty. Its only basic-mode field was the
long-input query, and the field list is advanced, so every segment dropped.

The sentence now leads with the knowledge base, matching the shape List Tables
already uses — both operations are knowledge-base scoped rather than
table-scoped, so it also reads more accurately.
@waleedlatif1
waleedlatif1 force-pushed the fix/agiloft-alrest-auth branch from 8734173 to be5d283 Compare August 11, 2026 23:21
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit be5d283. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@waleedlatif1
fix(agiloft): stop retrying refusals, and expose the outputs the new …
0aba13d
…operations return

Five findings from review that had gone unanswered.

An Agiloft refusal was surfacing as HTTP 500. readAlrestJson throws when the
envelope reports success:false, the route catch mapped that to 500, and the
tool runner retries 500s — so a create the server had already rejected could be
retried and duplicate the record. Refusals now return a settled failure with the
message intact; genuine faults still 500.

list_tables could not run in its primary mode. EWTable is knowledge-base scoped,
but some instances reject EWLogin without a $table, so whole-knowledge-base
discovery failed at login with nothing to fall back to. It now says what the
caller can do about it rather than surfacing the raw login error.

Upsert corrupted structured values. Every field went through String(), so a
multi-value field collapsed into one joined string instead of the documented
repeated key/value pairs, and an object silently wrote "[object Object]" into
the record. Arrays now encode as repeated pairs and objects are refused, since
Agiloft documents no encoding for them.

Two outputs were invisible in the editor. `records` was conditioned on
search_records alone, so natural language search results could not be chained,
and `callbackId` on run_action_button alone, so a queued upsert's callback could
not be wired into Async Status even though both values exist at runtime.
@vercel
vercel Bot temporarily deployed to Preview August 11, 2026 23:26 Inactive
@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Aug 11, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0aba13d. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@waleedlatif1
waleedlatif1 merged commit be5db68 into staging Aug 11, 2026
30 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1
waleedlatif1 deleted the fix/agiloft-alrest-auth branch August 11, 2026 23:32
This was referenced Aug 11, 2026
fix(agiloft): identify attachments by their bytes, not the content type #6573
Merged
chore: remove the stray .agiloft-spec working notes #6605
Merged
waleedlatif1 added a commit that referenced this pull request Aug 12, 2026
@waleedlatif1
chore: remove the stray .agiloft-spec working notes (#6605)
a40e379
Transcribed Agiloft REST docs committed by accident in #6562 alongside the
alrest repointing. Nothing imports or links it, it sits in a dot-directory at
the repo root rather than anywhere docs live, and the integration it informed
has shipped. Contents are the vendor's own public examples — placeholder
credentials and localhost hosts only, so nothing sensitive was exposed while
it was public.
@waleedlatif1 waleedlatif1 mentioned this pull request Aug 12, 2026
v0.8.0: desktop app, workflow UI, v2 endpoints #6606
Merged

This branch was previously deployed

1 inactive deployment
Preview — 0aba13d7 Deployed Aug 11, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
@cursor cursor[bot] cursor[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@waleedlatif1
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.