Connect
Connect Amp from the terminal. Pass --help for the flags Amp accepts.
polylane integration connect --type ampAn access token from Settings → Security in Amp.
Connect Amp to let Amp agents write the fixes that Polylane finds. Polylane investigates the issue and confirms the root cause. An Amp agent writes the change in a hosted orb and opens the pull request on your GitHub. You use your own Amp access token and credits.
- In Amp, go to Settings → Security and choose Copy Token. The token starts with
sgamp_. - In Amp, connect GitHub under Settings → Integrations, and add each repository you want fixed as an Amp project.
- Make sure that the Amp account has credits.
- Paste the token into Polylane. Polylane checks the token with the Amp CLI. The check does not start an orb and does not use credits.
When you connect Amp, it becomes the executor for every autofix of the workspace. To send autofixes back to Polylane's own agent, turn off Use Amp for all autofixes on the Amp integration page in Settings.
Polylane encrypts the token before it stores it, and the agent never sees it.
How it works
Polylane hands the fix to Amp
When a fix run confirms the root cause of an issue, Polylane writes a brief: the root cause, the change to make, and how to check it. Every brief tells Amp to run the typecheck, the lint and the tests of the repository, and to list each check in the pull request description. A fix from a chat thread also includes the change that Polylane wrote in its sandbox.
Before Amp starts, Polylane applies the same gates as for its own fixes: the autofix switch, the autofix quota, a fix already in progress, and an open pull request for the same fix.
Amp starts hosted runs only through its CLI. Polylane runs the official Amp CLI in a Polylane sandbox and starts one private thread in an orb, on the Amp project of the repository. When the thread exists, the CLI stops and the orb continues the work. The brief gives Amp a branch name and a marker, polylane-autofix: <id>, to put in the pull request description.
Code hosts
Amp works only with GitHub repositories. For a repository on GitLab, Polylane writes the fix in its own sandbox.
The pull request comes back
Polylane reads the thread every three minutes, for a maximum of six hours. Polylane accepts a pull request that Amp opened after the launch, on the branch from the brief or with the marker in its description. Polylane then records it on the autofix and adds a section with its evidence and the history of the fix. If the thread stops without a pull request, Polylane records the autofix as skipped.
When a run fails
If the thread fails or does not finish in six hours, Polylane's own agent takes the fix and writes it. If Polylane cannot reach Amp on five reads in sequence, the run stops and Polylane's agent takes over. A run that opened a pull request always counts as a success.
If Polylane cannot confirm that Amp started a thread, it does not start a second one. If Amp refuses the token, Polylane sends one notice and gives new fixes to its own agent until you reconnect or verify the integration.
Troubleshooting
When an Amp run fails, Polylane's own agent writes the fix. To let Amp do the next fix, correct the cause:
| What Polylane reports | What to do |
|---|---|
| The repository is not an Amp project | Add the repository as a project in Amp. |
| The Amp account is out of credits | Add credits in Amp. |
| Polylane could not confirm that Amp started the fix | Start the fix again. |
| Amp did not finish in the time limit | Give Amp a smaller task. |
| Amp refused the token | Copy a new token and reconnect Amp. |
Disconnecting
Disconnect Amp in Polylane. After you disconnect, Polylane's own agent writes new fixes.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Amp is removed as well; nothing is left behind.
polylane integration disconnect <id>