<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Livly</title>
    <description>The latest articles on DEV Community by Livly (@livly).</description>
    <link>https://dev.to/livly</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4210419%2F89d4798a-4cf5-4193-99cc-83165913fe14.png</url>
      <title>DEV Community: Livly</title>
      <link>https://dev.to/livly</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/livly"/>
    <language>en</language>
    <item>
      <title>Building a human-in-the-loop browser workflow for PhotoCraft AI</title>
      <dc:creator>Livly</dc:creator>
      <pubDate>Tue, 27 Oct 2026 14:45:17 +0000</pubDate>
      <link>https://dev.to/livly/building-a-human-in-the-loop-browser-workflow-for-photocraft-ai-2jgi</link>
      <guid>https://dev.to/livly/building-a-human-in-the-loop-browser-workflow-for-photocraft-ai-2jgi</guid>
      <description>&lt;p&gt;I operate PhotoCraft AI, an online image editor with PSD editing, conversational&lt;br&gt;
AI image editing, and AI image generation. Alongside the product, I am building a&lt;br&gt;
small browser workflow for preparing product submissions, with a human reviewing&lt;br&gt;
the final fields before anything is published.&lt;/p&gt;

&lt;p&gt;This article covers an early local test of that workflow: how to handle a browser&lt;br&gt;
command that reports a timeout after its action has already taken effect. It is&lt;br&gt;
not a claim about PhotoCraft's image-editing internals or a completed multi-platform&lt;br&gt;
submission system.&lt;/p&gt;
&lt;h2&gt;
  
  
  The observation
&lt;/h2&gt;

&lt;p&gt;During a local browser-automation test on macOS, a CLI click returned a timeout.&lt;br&gt;
The shell process still returned exit code 0. Inspection of the resulting browser&lt;br&gt;
state showed that the click's intended effect had occurred.&lt;/p&gt;

&lt;p&gt;This was a harmless local fixture: the button set a test cookie. It was not a&lt;br&gt;
payment, an email, or a public post. But it exposed the problem with treating every&lt;br&gt;
timeout as permission to retry a side effect.&lt;/p&gt;

&lt;p&gt;A timeout tells us the client did not observe the expected completion. It does&lt;br&gt;
not establish that the remote system did nothing.&lt;/p&gt;

&lt;p&gt;The example uses the name and URL of &lt;a href="https://photocraft.digital/" rel="noopener noreferrer"&gt;PhotoCraft AI&lt;/a&gt;,&lt;br&gt;
which I operate, as test data. All browser actions described here used a local&lt;br&gt;
HTML fixture; they did not submit an entry to a public website.&lt;/p&gt;
&lt;h2&gt;
  
  
  Keep the boundary before the external action
&lt;/h2&gt;

&lt;p&gt;For a small, human-assisted workflow, the important state transition is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;awaiting_confirmation → submitting → observed result
                                 ↘ unknown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit &lt;code&gt;submitting&lt;/code&gt; before clicking the final button. If the process crashes,&lt;br&gt;
the next run sees an unfinished external attempt rather than a fresh task.&lt;br&gt;
Do not automatically reset that state to the queue.&lt;/p&gt;

&lt;p&gt;The local application uses a database uniqueness constraint for one product at&lt;br&gt;
one opportunity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;site_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;channel_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That constraint prevents duplicate local records. It does not make a database&lt;br&gt;
transaction atomic with a third-party website. Existing website records and&lt;br&gt;
ambiguous outcomes still need read-only reconciliation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Check the command output as well as the exit code
&lt;/h2&gt;

&lt;p&gt;For the CLI version used in this test, an execution wrapper checks both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;returncode&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;### Error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;WorkflowError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Browser command failed; inspect the page before retrying any external action&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here &lt;code&gt;result&lt;/code&gt; is the captured CLI output. The wrapper writes output to an&lt;br&gt;
unlinked temporary file before reading it, avoiding a dependency on a detached&lt;br&gt;
daemon closing an inherited output pipe. A fresh browser launch through this&lt;br&gt;
wrapper was tested after changing the capture strategy.&lt;/p&gt;

&lt;p&gt;The textual marker is version-specific. Pin the tool, inspect its actual help&lt;br&gt;
and output, and test this behavior. The wrapper detects a command failure; it&lt;br&gt;
cannot decide whether the website accepted an action. That decision belongs to&lt;br&gt;
the workflow's reconciliation step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persisting a browser is a separate concern
&lt;/h2&gt;

&lt;p&gt;Another local test closed and reopened Chrome with the same persistent Profile.&lt;br&gt;
localStorage survived, but the test cookie did not. The cause has not been isolated.&lt;br&gt;
Explicit state export, reopening, state import and reload restored both markers&lt;br&gt;
in this environment.&lt;/p&gt;

&lt;p&gt;This is evidence for a tested recovery path, not a claim that Profile persistence&lt;br&gt;
is generally broken or that an exported state file covers every authentication&lt;br&gt;
method. OAuth, sessionStorage, IndexedDB and a site's own expiration policy need&lt;br&gt;
their own tests. Authentication exports also need to be treated as credentials.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests worth keeping
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Reimporting the same opportunity must not reset a submitted record.&lt;/li&gt;
&lt;li&gt;A process restart must leave &lt;code&gt;submitting&lt;/code&gt; blocked from automatic retries.&lt;/li&gt;
&lt;li&gt;A timeout must not be translated into a proven, retryable rejection.&lt;/li&gt;
&lt;li&gt;A paid or explicitly restricted opportunity must be rejected before execution.&lt;/li&gt;
&lt;li&gt;A pending-review receipt must not become a failure because no public URL exists.&lt;/li&gt;
&lt;li&gt;A public page containing the product name must not count as a verified link
unless its actual anchor points to the intended target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For human handoff, a local fixture let the user complete a browser step directly.&lt;br&gt;
The agent then read a fresh snapshot and continued. This tests cooperation without&lt;br&gt;
using a real account, a challenge bypass, or a public side effect.&lt;/p&gt;

&lt;p&gt;The practical limit is that these checks reduce accidental repetition; they do&lt;br&gt;
not promise exactly-once delivery to a third-party form.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: AI assisted in drafting this article using the implementation&lt;br&gt;
and local test observations described above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>automation</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
