stackblitz / bolt.new

Prompt, run, edit, and deploy full-stack web applications
https://bolt.new
MIT License
5.68k stars 1.41k forks source link

Bug: AI replacing actual code with code comments like // ...remaining code here #124

Open FastTrackAudio opened 2 weeks ago

FastTrackAudio commented 2 weeks ago

Describe the bug

When making smaller changes to a file, the AI will just write in something like "This part of code stays the same" without actually keeping the code, they just replace it with a comment like

// ... (previous imports remain the same)

interface QuizTakerProps {}

const QuizTaker: React.FC = () => { // ... (rest of the component code remains the same, remove any usage of quizId) }

export default QuizTaker

This breaks the application everytime and uses more tokens to fix, its been the only annoying part of going back and forth, even prompting it with "rewrite the entire file to ensure all code is there and the file is complete" only works 80% of the time.

I know its hard, but it would be cool if it just modified the code that had to be modified, instead of rewriting the entire file from scratch.

Link to the Bolt URL that caused the error

https://bolt.new/~/sb1-fkyaen

Steps to reproduce

write an application that has any sort of complexity, then ask it to just make a minor change to part of it that doesn't affect one of the subparts of it.

Expected behavior

I expect the code that stays the same to still be there

Screen Recording / Screenshot

No response

Platform

Additional context

I LOVE THIS TOOL, only reporting to make it better!

also, it doesn't tell me when my tokens refresh

kirjavascript commented 2 weeks ago

Hi! šŸ‘‹ Thanks for the comments!

This is an annoying and recurring. We have ideas on how to reduce it from happening but it's going to take some time.

For now, there is a workaround: To prevent it from deleting old code, asking it to always provide the full code helps a bit and asking it to restore the placeholders with actual code helps too.

FastTrackAudio commented 2 weeks ago

thank you for the verbage, I think Restore The Placeholders + full code in each prompt will definitely help. You guys are masterminds! Can't wait to try it when my limit refreshes

I wonder if it could be as simple as appending some sort of keyphrase that ends up working really well to the end of every single one of a users requests (maybe make it a toggle setting in the settings menu)

Just so the User doesn't have to copy and paste it everytime, but it is still taken into consideration by the AI.

eliaspizarro commented 1 week ago

// ... (previous code remains the same)

kc0tlh commented 1 week ago

šŸšØ IMPORTANT UPDATE a partial workaround for this issue is now available: when this occurs, you can simply revert the codebase back to the previous state with a single click, without prompting the AI/using token. Details here: https://x.com/stackblitz/status/1844839379270836266

We are working on a more full solution as well of course, so stay tuned!

Additionally, here are some tips shared by TheTigur in our discord to reduce the unwanted behavior in the meantime:

Isolate Changes: Clearly specify which section or element you want to change, and explicitly tell Bolt to leave everything else as it is.

Be Specific About What Should Remain Unchanged: Mention explicitly that no modifications should occur to other parts of the site.

Mention Code Segments or Classes: If possible, refer to specific divs, classes, or functions to guide Bolt to the exact place where you want the changes made.

pk-pathkraft commented 4 days ago

i am also facing the same issue, i am building a WordPress plugin with bolt.new

initial prompts went find till a few versions,, i was excited the way it was generating things, i was gradually prompting and adding more features, but after a while bolt started loosing the context , after inspection of the code i found that the main files the code were missing after a point of time and i was seeing this

// ... (rest of the code remains the same)

Which explains why there were errors and functionality loss, i tried various prompts to evade this loop but not very successful .

i am a paid user, and i lost a of lot of tokens and time trying to come over this issue, more importantly the whole tempo and mood and speed of development god halted.... hope this will be fixed soon

kc0tlh commented 3 days ago

šŸŽ‰ FIX LANDED we have shipped an update that should permanently resolve this issue! Please share examples if you are still experiencing this error after 1pm PST on October 22'nd.