Repository navigation
Conversation
Two proposed edits, not yet implemented: 1. Every single-shot op (eval, dispatch, trace-recent, console-tail, handler-source, app-summary) unconditionally calls ensure-injected! before the real work, paying a full browser round trip to check a sentinel that's almost always already satisfied. An optimistic try-first-then-fix-on-failure helper cuts this to one round trip in the common case. 2. console-tail.sh/trace-recent.sh are pull-only, so an agent polling repeatedly across a session pays a browser round trip per check even though the runtime already buffers this data for free. A file-backed background daemon (reusing the existing proven pull-mode primitives, not the unproven :out-streaming sketch in docs/initial-spec.md §4.4) turns repeated reads into plain local file reads. docs/agent-latency-improvements.md has the full design: exact code, a retry-safety proof, a test-impact walk of the existing 57 ops_smoke.bb deftests, and an implementation checklist.
Author
|
Closing — meant to file this as an issue, not a PR. Filing the issue now with the same content. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design doc only — no
scripts/behavior changes in this PR. Written so it can be implemented directly from the doc by whoever (human or agent) picks it up next.Two independent proposed edits to cut agent-perceived latency, both documented in full in
docs/agent-latency-improvements.md:Stop paying for a redundant sentinel round trip on every single-shot op.
eval-op,dispatch-op,trace-recent-op,console-tail-op,handler-source-op, andapp-summary-opall callensure-injected!unconditionally before doing the real work — which itself is a fullcljs-evalbrowser round trip, even though re-injection is only ever needed once per hard page refresh. The doc specifies awith-optimistic-injecthelper (try the real call first, only fall back to the existingensure-injected!machinery on failure) that cuts this to one round trip in the common case, with a retry-safety proof (missing-runtime failures happen at CLJS analysis time, before any side effect ships to the browser, so retrying is safe even fordispatch-op) and a full call-count/exception-shape test-impact walk against all 57 existingtests/ops_smoke.bbdeftests.A file-backed activity daemon for high-frequency polling.
console-tail.sh/trace-recent.share pull-only, so an agent that polls repeatedly across a long debugging session pays a browser round trip per check, even though the runtime already buffers this data for free in-browser. The doc specifies a newdaemonsubcommand +scripts/daemon.shwrapper that reuses the already proven pull-mode primitives (epochs-since,console-tail-since, the same combined-poll patternwatch-opalready uses) as a long-lived background process appending to local EDN files — turning repeated reads into plain file reads instead of browser round trips. This deliberately sidesteps the streaming-via-:outmechanism sketched (and left "unproven") indocs/initial-spec.md§4.4, rather than trying to prove it.STATUS.md's Near-term and Deferred sections now cross-link the doc.Why a docs-only PR
Wanted a second pair of eyes (human or AI) on the design before touching
scripts/ops.clj— particularly the retry-safety argument for edit 1 and the explicit scope-out ofwatch-op/tail-build-op(§1.4 in the doc), which have existing tests pinning an exact connection-reuse invariant that a naive global application of the optimistic-retry pattern would break.Test plan
scripts/changes.npm testshould be unaffected; not re-run here since nothing changed that it covers.