AI Coding Models Tested: Building a GUI Tool with Zero Runtime Errors

    This article examines a practical question that benchmark scores do not answer: when an AI coding tool generates a desktop GUI utility, which parts fail most often, and how should requirements and acceptance criteria be written so the output is actually deliverable. Using a batch audio extraction tool as the test vehicle, it covers requirement design that makes the "no frozen UI" constraint explicit, the correct threading model that separates generated code that passes from code that fails, external dependency probing and exception handling, and a five-step acceptance workflow. It also shows how follow-up questions in natural language can serve as code review. The full loop takes roughly ten minutes and catches interface freezes and silent file overwrites before release.

    1. Background: Why “it runs” is not the same as “it works”

    A new generation of open-source large models has been widely discussed for its coding benchmark results. Public information generally reports a significant improvement over the previous generation, approaching the level of leading closed-source models. But there is a clear gap between benchmark scores and real engineering experience: benchmark problems are typically single-file, single-function algorithm tasks with no external dependencies, while real requirements often involve multithreading, external process invocation, filesystem operations, and state synchronization.

    This article does not restate the evaluation conclusions of any specific product. Instead, it focuses on a more general technical question: when you use an AI coding tool to generate a desktop tool with a graphical interface, which stages fail most easily, and how should you design requirements and acceptance criteria so the generated result is genuinely deliverable.

    The test vehicle I chose is a typical high-frequency small utility: batch audio extraction from video. It covers format parsing, batch task scheduling, an external transcoding dependency, long-running tasks, and UI feedback at the same time, which makes it a good sample for testing generative coding ability.

    2. Requirement Design: Writing the “newbie killer” pitfalls into the prompt

    The quality of the requirement description directly determines the quality of the output. Rather than saying vaguely “write a conversion tool,” it is better to make constraints explicit. My requirement list contained six categories:

    • Input side: support common video container formats; output side: support mainstream audio formats;
    • Tech stack: a scripting language plus the standard library GUI framework, avoiding heavy third-party dependencies;
    • Interaction structure: a file import list, an area for output format and directory settings, and entry points for execution and exit;
    • Status feedback: progress bar, status bar, error messages;
    • Non-functional constraints: reasonable layout, resizable window, smooth operation;
    • The critical red line: the interface must not freeze.

    The last item is the core of the whole test. GUI frameworks use a single-threaded event loop by default. If any time-consuming logic is written inside an event callback, the event queue cannot be consumed and the window enters a “not responding” state. This is not a code style issue but an architectural one, and it is where a large number of shortcut solutions fail.

    3. The Correct Threading Model: The dividing line for generated code

    A passing implementation must satisfy three conditions: the time-consuming task runs on a worker thread, the worker thread does not directly manipulate UI widgets, and progress and results are passed back to the main thread in a thread-safe way. Illustrative code:

    1. import threading, queue
    2. class Worker(threading.Thread):
    3. def __init__(self, tasks, q):
    4. super().__init__(daemon=True)
    5. self.tasks, self.q = tasks, q
    6. def run(self):
    7. total = len(self.tasks)
    8. for i, t in enumerate(self.tasks, 1):
    9. try:
    10. convert(t) # blocking work happens only on the worker thread
    11. self.q.put(("progress", i / total, f"Done {t.name}"))
    12. except Exception as e:
    13. self.q.put(("error", str(e), t.name))
    14. self.q.put(("done", 1.0, "All tasks finished"))
    15. # The main thread polls the queue with a timer and never touches widgets across threads
    16. def pump(root, q, bar, status):
    17. while not q.empty():
    18. kind, a, b = q.get()
    19. if kind == "progress":
    20. bar["value"] = a * 100; status.config(text=b)
    21. elif kind == "error":
    22. status.config(text=f"Failed: {b}")
    23. else:
    24. status.config(text=b)
    25. root.after(100, pump, root, q, bar, status)

    The key design here is after polling plus queue buffering: the worker thread only computes and posts messages, and the main thread updates widgets only inside the event loop. If the generated result contains time.sleep or a transcoding call written directly in a button callback, it can be judged as failing without running it at all.

    4. External Dependencies and Exception Paths: Easily Overlooked Engineering Details

    Batch transcoding usually depends on an external command-line transcoder, which brings two kinds of risk: a missing dependency and an out-of-control child process. A robust implementation should probe availability once before starting conversion, and give clear guidance when the dependency is missing instead of throwing a stack trace. When invoking the child process, it should capture standard error output, set a timeout, avoid blocking popups, and collect failed items in the results area rather than aborting the whole batch.

    Three more high-frequency details can serve as an acceptance checklist:

    1. Same-name file protection: automatically append a sequence number when a file with the same name already exists in the output directory, avoiding silent overwrites;
    2. Directory recursion and format completion: support scanning subdirectories and build in a whitelist of common audio and video extensions;
    3. Path default semantics: whether the output directory defaults to the program’s own directory or a user-selected directory must be stated clearly in the interface and the documentation, so users do not misjudge where data lands.

    5. Follow-Up Verification: Code Review in Natural Language

    After generation, do not just check whether it compiles. I added a follow-up question about the default path semantics, and the model’s answer matched the code implementation, which shows it has a traceable understanding of its own output rather than randomly assembled pieces. This loop of “ask, compare, locate” is the key action for bringing generative tools into an engineering workflow: write review comments in natural language, have the model explain its implementation trade-offs, then go back to the code to verify.

    6. A Reusable Acceptance Workflow

    It is worth fixing as five steps: make requirements explicit (including non-functional constraints) → statically review the threading model and dependency probing → compile and check syntax → run a small-sample end-to-end test → ask about key semantics and re-verify. The whole process takes on the order of ten minutes at very low cost, yet what it catches is often the hardest problems to diagnose after release: interface freezes and data overwrites.

    7. Conclusion

    The value of AI coding tools lies not in generating perfect code in one shot, but in moving requirement clarification, architectural constraints, and acceptance criteria forward into the prompt stage. When you can lock down “do not freeze the interface” in one sentence and know which three places to check in the code, AI turns from a toy into a reliable pair developer. If you need to carry more complex task scheduling and artifact management, you can layer on general cloud capabilities such as container platforms, object storage, and log monitoring to form a complete engineering loop.