{
    "version": "https://jsonfeed.org/version/1",
    "title": "Synapsys Blog",
    "home_page_url": "https://docs.synapsys.jmzworks.it/blog",
    "description": "Synapsys Blog",
    "items": [
        {
            "id": "https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens",
            "content_html": "<p>Synapsys workers do not accept inbound connections. Everything — every report and\nevery command — rides a single outbound POST the worker makes every few seconds.</p>\n<p>That leaves one question: how does the Core tell a worker to do something exactly\nonce?</p>\n<!-- -->\n<h2 class=\"anchor anchorTargetStickyNavbar_Vzrq\" id=\"the-obvious-design-is-wrong\">The obvious design is wrong<a href=\"https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens#the-obvious-design-is-wrong\" class=\"hash-link\" aria-label=\"Direct link to The obvious design is wrong\" title=\"Direct link to The obvious design is wrong\" translate=\"no\">​</a></h2>\n<p>Send the desired state, let the worker compare it against what it is doing, and\nact on the difference.</p>\n<div class=\"language-text codeBlockContainer_Ckt0 theme-code-block\" style=\"--prism-color:#bfc7d5;--prism-background-color:#292d3e\"><div class=\"codeBlockContent_QJqH\"><pre tabindex=\"0\" class=\"prism-code language-text codeBlock_bY9V thin-scrollbar\" style=\"color:#bfc7d5;background-color:#292d3e\"><code class=\"codeBlockLines_e6Vv\"><div class=\"token-line\" style=\"color:#bfc7d5\"><span class=\"token plain\">if (desiredState != currentState) apply(desiredState);</span><br></div></code></pre></div></div>\n<p>This replays. A process that takes thirty seconds to stop reports <code>stopping</code> for\nsix consecutive beats, and on each one the desired state still differs from the\ncurrent state, so the command fires again. With a start command it is worse: you\nget six starts.</p>\n<p>You can patch around it — suppress commands while a transition is in flight, add a\ngrace period — but every patch is a guess about timing, and timing is exactly what\nan unreliable network takes away from you.</p>\n<h2 class=\"anchor anchorTargetStickyNavbar_Vzrq\" id=\"what-synapsys-does\">What Synapsys does<a href=\"https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens#what-synapsys-does\" class=\"hash-link\" aria-label=\"Direct link to What Synapsys does\" title=\"Direct link to What Synapsys does\" translate=\"no\">​</a></h2>\n<p>The Core keeps a <strong><code>desiredToken</code></strong> per process and increments it on every user\ncommand. The worker keeps the last token it actually applied, as <strong><code>ackToken</code></strong>,\nand reports it on every heartbeat.</p>\n<div class=\"language-text codeBlockContainer_Ckt0 theme-code-block\" style=\"--prism-color:#bfc7d5;--prism-background-color:#292d3e\"><div class=\"codeBlockContent_QJqH\"><pre tabindex=\"0\" class=\"prism-code language-text codeBlock_bY9V thin-scrollbar\" style=\"color:#bfc7d5;background-color:#292d3e\"><code class=\"codeBlockLines_e6Vv\"><div class=\"token-line\" style=\"color:#bfc7d5\"><span class=\"token plain\">if (desiredToken &gt; ackToken) {</span><br></div><div class=\"token-line\" style=\"color:#bfc7d5\"><span class=\"token plain\">    apply(desiredState);</span><br></div><div class=\"token-line\" style=\"color:#bfc7d5\"><span class=\"token plain\">    ackToken = desiredToken;</span><br></div><div class=\"token-line\" style=\"color:#bfc7d5\"><span class=\"token plain\">}</span><br></div></code></pre></div></div>\n<p>Duplicates are now arithmetic rather than judgement. The same response delivered\nsix times applies once, because after the first the tokens are equal.</p>\n<h2 class=\"anchor anchorTargetStickyNavbar_Vzrq\" id=\"the-consequences-worth-knowing\">The consequences worth knowing<a href=\"https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens#the-consequences-worth-knowing\" class=\"hash-link\" aria-label=\"Direct link to The consequences worth knowing\" title=\"Direct link to The consequences worth knowing\" translate=\"no\">​</a></h2>\n<p><strong><code>idle</code> had to stop meaning \"stop\".</strong> Once a command completes, the Core resets\n<code>desiredState</code> to <code>idle</code> to mean \"nothing outstanding\". Any client that reads that\nas an instruction shuts down everything it owns. So <code>idle</code> means <em>no command</em>, and\nstop is <code>stopping</code>.</p>\n<p><strong><code>failed</code> cannot be commanded.</strong> A state you can be in is not necessarily a state\nyou can be told to enter. Nothing can be instructed to fail, so validity is\nchecked twice — once for what a worker may report, once for what the Core may\nask for.</p>\n<p><strong>Order matters at the edges.</strong> Update <code>ackToken</code> after applying, never before. A\nclient that acknowledges first and crashes has lost the command, because the Core\nwill consider it done.</p>\n<h2 class=\"anchor anchorTargetStickyNavbar_Vzrq\" id=\"why-this-is-in-the-docs-not-just-the-code\">Why this is in the docs, not just the code<a href=\"https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens#why-this-is-in-the-docs-not-just-the-code\" class=\"hash-link\" aria-label=\"Direct link to Why this is in the docs, not just the code\" title=\"Direct link to Why this is in the docs, not just the code\" translate=\"no\">​</a></h2>\n<p>Every future starter — Go, Python, whatever comes after — reimplements this loop.\nIt is the one piece of Synapsys that cannot be encapsulated in a library, because\nit <em>is</em> the thing each library independently has to get right.</p>\n<p>That is also why Raw API is a first-class connection method rather than a\nfallback: the protocol is the product.</p>",
            "url": "https://docs.synapsys.jmzworks.it/blog/2026/08/25/why-tokens",
            "title": "Why commands are matched by token, not by state",
            "summary": "The obvious design replays every command. Here is what Synapsys does instead.",
            "date_modified": "2026-08-25T00:00:00.000Z",
            "tags": []
        }
    ]
}