Going crazy with port & code problems - HELP!

Agent and Assistant seem to want to do things their own way. Agent keeps reverting port config to something that shows a completely different landing page than Assistant does when it restarts. I don’t understand it at all, despite hours and hours of debugging, it keeps reverting back.

Can anyone take a look at this .replit and tell me what the heck is going on?!

FWIW, “Dev” workflow is the RIGHT one, that does the right things.

modules = [“nodejs-20”, “web”, “postgresql-16”]
run = “npm run dev”
hidden = [“.config”, “.git”, “generated-icon.png”, “node_modules”, “dist”]

[nix]
channel = “stable-24_05”

[deployment]
deploymentTarget = “gce”
build = [“npm”, “run”, “build”]
run = [“sh”, “-c”, “npm run start”]

[[ports]]
localPort = 3000
externalPort = 3000

[[ports]]
localPort = 3001
externalPort = 3001

[[ports]]
localPort = 8080
externalPort = 80

[workflows]
runButton = “Dev”

[[workflows.workflow]]
name = “Project”
mode = “parallel”
author = “agent”

[[workflows.workflow.tasks]]
task = “workflow.run”
args = “Start application”

[[workflows.workflow.tasks]]
task = “workflow.run”
args = “Client”

[[workflows.workflow.tasks]]
task = “workflow.run”
args = “Server”

[[workflows.workflow]]
name = “Dev Server”
author = 36296011

[[workflows.workflow.tasks]]
task = “shell.exec”
args = “npm run dev”

[[workflows.workflow]]
name = “Dev”
author = 36296011

[[workflows.workflow.tasks]]
task = “shell.exec”
args = “PORT=3000 NODE_ENV=development tsx watch --clear-screen=false server/index.ts”

[[workflows.workflow]]
name = “Start application”
author = “agent”

[workflows.workflow.metadata]
agentRequireRestartOnSave = false

[[workflows.workflow.tasks]]
task = “shell.exec”
args = “PORT=3001 NODE_ENV=development tsx watch --clear-screen=false server/index.ts”

[[workflows.workflow]]
name = “Client”
author = “agent”

[workflows.workflow.metadata]
agentRequireRestartOnSave = false

[[workflows.workflow.tasks]]
task = “packager.installForAll”

[[workflows.workflow.tasks]]
task = “shell.exec”
args = “cd client && npm run dev”
waitForPort = 3000

[[workflows.workflow]]
name = “Server”
author = “agent”

[workflows.workflow.metadata]
agentRequireRestartOnSave = false

[[workflows.workflow.tasks]]
task = “packager.installForAll”

[[workflows.workflow.tasks]]
task = “shell.exec”
args = “PORT=3001 npm run dev”
waitForPort = 3001

I was able to fight through this with Agent/Assistant - but if I don’t explicitly tell Agent not to revert and ruin it, it will consistently revert to settings that do not work.

I suggest creating a new project with the same stack to check the default configuration.

You could also ask the Assistant or Agent to fix the .replit file, using the default configuration from the other project as a reference.

I’ve sometimes asked the Agent to remove specific workflows since workflows created by the Agent can’t be deleted from the Workflows UI, and editing the .replit file isn’t straightforward.

ChatGPT also provides good advice on this topic

I ended up using ChatGPT, but even that was a struggle.

This particular repl now requires me to explicitly say “DO NOT TOUCH NETWORK CONFIG OR OTHER UNRELATED CODE” after each prompt. If I don’t, Agent immediately tries to bork the .replit again and revert my changes. Insanity!

May not be applicable, but I found that Agent/Assistant would mess with my ports if I didn’t stop the repl when switching between them. Now I go so far as to stop my repl, go to replit home, open the repl, and then select agent or assistant.

1 Like

you can add that instruction as a comment for the agent in your server code and it’ll normally respect it

Brilliant Kody, thank you.

1 Like

Yes I causing more frustration for the user but more revenue for Replit !! But in the long run this will prove to hurt their revenue stream as it is so frustrating it drives users off the system.