Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Fix and improve your app

Once your app is live, ask your agent to check it for problems, read what people said, and ship the fix, all in one pass.

Check for problems

Ask your agent to open the app. Every get_app call attaches a summary of what broke since the current revision was published: runtime errors, CSP violations (the browser blocking something the app tried to load), mismatches between the app’s interface and its backend, failed API calls, app load errors, and external image failures, each with a count and a recent example. If nothing broke, the summary doesn’t show up at all.

External image failures remain visible to the agent even when the app catches the failed load and shows its own fallback. Use the reported provider status and recovery suggestion to choose a working source or a permitted uploaded copy. A placeholder does not prove the image was repaired.

That summary only covers the current revision. The full log goes back across every revision.

When someone using a shared app hits a failure, the widget shows you a notification with a Fix with agent button. It copies a prompt for your agent with a private reference to the problem. Paste it within 10 minutes; after that the reference expires and you click the button again. An agent connected over MCP resolves the reference with resolve_handoff; a CLI agent uses charming api request get-widget-runtime-issue-handoff. Either way the agent gets the failing action, path, and the app’s error message, and only your account can read them.

To read the problem yourself, click Details on the notification. It shows what failed, the error message (the app’s own, or Charming’s when a time limit stopped the work), the path the call asked for, when it last failed, and how often it failed recently: for people using the live version, or for the Routine whose run failed, over the last 7 days or your plan’s shorter activity window. The app settings Activity page has a Details button on every failed app action, including a Routine’s failed runs with the reason Charming recorded, such as a timeout. Its Fix with agent button hands your agent a reference to that exact failure, the same way the widget does. History and the agent links open in a new tab. Only the app’s owner and team admins see these details.

Read what people said

People using the app can send a bug report or a suggestion from a button Charming puts in the app’s toolbar, no code required on your end. Ask your agent to check an app’s feedback and it lists what people said, newest first. See Feedback for how the button works and what a submission looks like.

Apply suggested improvements

When your agent saves the app or reads its code, Charming checks the code that runs on the server for patterns that make runs slow, such as loading the same stored data twice in one run or waiting for one request at a time. When it finds some, the result ends with a short Suggested improvements list. Each item says where it is, why it matters, and what to change, and the list shows at most five at a time, the most serious first. A save result ends by asking your agent to apply them all in one update; a read result asks it to apply them with its next change.

Anyone who can read the app’s source sees the list: the owner, team members who can edit, and editors. Viewers and visitors never see it. The list names code and run times, never stored data or a secret. It never stops, slows, or changes a save or a read; if the check fails, the result arrives without it.

Ship the fix

Once your agent knows what’s broken, from the runtime summary, the feedback, the suggested improvements, or all three, ask it to fix the app. It calls update_app with either the app’s whole set of files or a small set of exact-string edits that name the file each one changes. The tool returns an accepted build; the agent polls get_app_build until published, then calls get_app to verify the fix. The last working app stays active while the new one builds, and a failed build leaves it unchanged. Whatever the app has stored survives the update: only the code changes, not the data. See Data storage for what “survives” covers and How Charming works for the full build-and-update cycle.

Technical

The core calls are: get_app for the runtime summary, list_feedback for what people said, and update_app to ship the fix. None of them needs the app’s activity log to run the loop day to day; that log is there for when the summary isn’t enough.

Copy this prompt for your agent

Check my Charming app for problems and fix what you find. Read
https://charm.ing/docs/guides/fix-and-improve-your-app.md first. Open
the app, review any runtime issues, feedback, and suggested
improvements attached to it, and ship a fix for anything
actionable. Ask me before making a change that isn't obvious from
the issues or feedback text.

How an agent performs this job

get_app returns current-revision issues when present and names the CLI command for the full activity timeline.

resolve_handoff turns a pasted Fix with agent reference into the failing operation, path, and error message. Only the app owner’s account can resolve it.

list_feedback reads user and agent feedback. See Feedback for the workflow.

update_app accepts the whole tree as files or exact edits that each name a path, with expected_revision from a fresh get_app_source. Update description in package.json when app behavior changes.

Suggested improvements

create_app, update_app, get_app, and get_app_source add the block to the text result, after any notice about unset secrets, and the same items to the structured result as codeAdvisories. Each item has id, severity (warn or info), title, locations (file and line; file is a package path such as server.js, or module for an App saved before packages), why, and fix. The field is absent when there is nothing to suggest. Charming checks server.js and the files it imports, not ui.js or the files only the browser loads. Each check reports only a pattern it can see completely in the source; when it is unsure, it says nothing. A name copied from the source into an item is a plain identifier; any other name is replaced by its line number.

id Severity What it means Fix
repeated-full-load warn A function that lists storage and reads the values one key at a time runs two or more times with the same arguments in one run of the same op, or once inside a loop, called directly or through other functions in the same file. Each call repeats all of those reads. A call behind ??= or one whose result is kept in a module-scope variable or one of its members does not count, and a loop that can return or break after the call, such as a retry, does not count as repeating it. Call it once in the op and pass its result to the code that needs it.
sequential-fetch-loop info A for loop awaits one read fetch per item, and each request is independent of the one before, so the loop takes as long as all of its requests added together. A loop that can stop early, waits between requests, sends a request that may write, walks a list of three items or fewer, or builds a request or its stop condition from an earlier response is left alone. Start the requests together with Promise.all, a few at a time, or ask the API for one page that holds them all.
module-near-cap warn Save results only. On an App saved before packages, module or ui is above 90% of its 256 KiB cap. A save past the cap fails with module_too_large or ui_too_large. Delete code nothing calls, or move the App to a package without resending its source: a migration save builds each file with { "from": "module", "edits": [...] }, and a package holds up to 64 files and 1 MiB of source.
routine-near-limit warn Read results only. A Routine’s runs at the live revision hit the 30 s operation time limit, or one took more than 60% of it. Repeated failures turn the Routine off. Runs of an earlier revision do not count, so a save that changes the code starts with a clean record. When the run was measured, the advisory also says how many storage calls it made, how long they took, and how many other Routines of the App ran at the same time. Do less in each run: load stored data once and reuse it, start independent requests together, or handle part of the work on each run.

When an operation throws

A route handler that throws a plain Error fails the call as operation_failed with status 500. A caller who can edit the app, such as its owner, a collaborator, or the app’s own token, gets the thrown message. Everyone else gets The operation failed. instead: viewers, end users, signed-out visitors, the page’s own calls, and Webhook senders. The rule is the same over HTTP (/app/{id}/api/*), query_app, mutate_app, and each App’s own MCP tools. A Routine tick always records the thrown message.

Over HTTP, query_app, and mutate_app, the error also carries a traceId. It matches an entry in GET /app/{id}/diag that holds the full message and stack. The failure also appears in the activity timeline with the app’s error message.

Read the activity timeline with the CLI

Use a personal access token for a user who can manage the app:

charming api request get-app-activity-timeline --param appId=APP_ID --param limit=50

This calls GET /api/v1/apps/{appId}/activity for published versions, renders/runs, API-call outcomes, sharing changes, and feedback. Its response includes items, hasMore, and retention. To fetch older entries when hasMore is true, pass both --param before=OLDEST_TS and --param beforeId=OLDEST_ID from the oldest returned item. Optional kinds and since filters narrow the results.

charming api request get-app-activity --param id=APP_ID remains the separate durable runtime-failure log at GET /app/{id}/activity, with its existing {ok,value:{items,retention}} response.

The contract

The generated MCP reference and REST API reference define schemas, filters, and auth errors.

Was this page helpful?