Skip to content

fix(serve): the serving cut-off is 2 seconds while Cue is new - #58

Merged
lukemaj merged 1 commit into
mainfrom
fix/chromeria-248-serving-cutoff-2s
Oct 13, 2026
Merged

lukemaj merged 1 commit into
mainfrom
fix/chromeria-248-serving-cutoff-2s

Conversation

@lukemaj

@lukemaj lukemaj commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What changed: the serving hook now waits up to 2 seconds for a reply (connect up to 1 second; Grok stays at 4), and the OpenCode plugin up to 2 seconds; v0.5.6.
Why: the hook cut moments at 1 s total and 0.1 s connect, and since Cue went live 40 tool results on rocky had no pre-tool moment at all; the user decided to raise the cut-off to 2 s while Cue is new ("first we make it work, then we make it better", toolboxmd/chromeria#248).
So what: pairs with toolboxmd/chromeria#251 (Cue waits 1.5 s); after both merge the hook and the reinstalled OpenCode plugin are deployed on rocky, cavallo and bestia, and the lost-moment rate is measured on chromeria#248.

Part of toolboxmd/chromeria#248.

Change

  • bin/contextmd-hook: deadline 1 -> 2 (Grok 4 unchanged), --connect-timeout 0.1 -> 1; header and comment state the cut-off and its reason.
  • contextmd/serve/opencode/contextmd.js: the moment request's AbortSignal.timeout 1000 -> 2000 (settle stays 300 ms).
  • README.md: the server-down sentence states the new limits.
  • Installed hooks already allow 5 s (install.py), checked live on all three machines.

Proof (head 293ba1e25c)

  • test_hooks_wait_two_seconds_and_grok_four (replaces the 1 s test): a 1.5 s server now answers claude; at 2.5 s claude fails open in under 2.4 s while grok still answers. Failed at the old limits.
  • OpenCodeCutoffTest: a reply taking 1.5 s now reaches the OpenCode user message. Failed at 1 s.
  • CONTEXTMD_CHROMERIA=<chromeria with the paired Cue change> python3 -m unittest discover -s tests -t .: OK. (Against an older Chromeria without #240 one contract test fails as expected.)
  • versionctl release-check: v0.5.6 OK.

Elon record

  • Requirements and who asked: serving cut-off 2 s and connect 1 s (user, 2026-10-13, via the planner on chromeria#248).
  • Deleted: nothing; the faster aim stays on #248 and Router: test the input window format on the 0.6B student #20.
  • Bottleneck: moments cut at the hook before they reach serving.
  • Checked myself: the hook and plugin limits, the installed hook timeouts on rocky, cavallo and bestia, and the runs above.

🤖 Generated with Claude Code

@lukemaj

lukemaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

What: PASS at 293ba1e25c951469bd4c03bd0db1c885a4bf37f7, with no blocking findings.
Why: The shell hook and OpenCode retain fail-open behavior while allowing replies between one and two seconds.
So what: Proceed with paired chromeria#251; whichever of this PR and contextmd#56 merges second must rebase and advance the version.

  • Verified curl connect limit 1 s, total 2 s including connect, Grok total 4 s, OpenCode moment abort 2 s, and both settle requests 300 ms. install.py sets host hook timeout 5 s, so even Grok's moment plus settle fits that envelope. Installed-host 5 s values are the supplied task premise, not rechecked live here.
  • Paired server Cue waits 1.5 s for user messages and failures, collects 300 ms after successful calls, connects to Cue within 500 ms, sends a 1.5 s queue deadline, and bounds the background exchange at 2 s. There is no separate earlier overall route deadline.
  • PYTHONDONTWRITEBYTECODE=1 CONTEXTMD_CHROMERIA=<exact #251 worktree> python3 -m unittest discover -s tests -t .: 119/119 passed, including 18 production-server contracts. Initial missing-dependency setup error was corrected in the temporary clone before this passing run.
  • Holding head tests constant on base b62293180977058c70cb79e0a6b0b3b3bb9198dc: the two new cutoff regressions both fail for the intended reason (empty Claude reply and no OpenCode rule at 1.5 s). The head suite verifies slow-server fail-open and Grok's longer wait.
  • docs: add docs/map.md, the ContextMD feature map #56 is still open and also claims 0.5.6. This is merge-order bookkeeping, not a defect in this head.
  • These are component deadlines, not a demonstrated hard bound for every real workload. Slow filesystem, projection or authentication work can consume the remaining budget; #248's production timing and post-deploy acceptance remain unverified here.

Read the complete PR diff and body, linked Issue and all prior PR/Issue comments, including inline review comments. No private data or credentials found in the changes. Testing used only my clones/worktrees under /tmp; no main checkout writes, live Chromeria ports, live database access or restart. Reviewer: independent Sol, medium effort.

curl -m 1 and --connect-timeout 0.1 cut moments that took longer once Cue
went live: 40 tool results on rocky had no pre-tool moment at all. The hook
now allows 2 s (connect 1 s; Grok stays at 4 s) and the OpenCode plugin 2 s.
User decision 2026-10-13: first make it work, then make it better (#248).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lukemaj
lukemaj force-pushed the fix/chromeria-248-serving-cutoff-2s branch from 293ba1e to 8692515 Compare October 13, 2026 17:53
@lukemaj

lukemaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Version-only rebase onto main 8d496f4 (v0.5.6, #56): head 8692515fe3, v0.5.7, from reviewed 293ba1e25c. The patch to bin/contextmd-hook, contextmd/serve/opencode/contextmd.js, README.md and tests/test_serve.py is byte-identical; only VERSION and CHANGELOG changed. Full suite OK against chromeria#251.

@lukemaj

lukemaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

What: PASS at 293ba1e25c951469bd4c03bd0db1c885a4bf37f7. No blocking findings.
Why: The hook waits 2 s total and 1 s to connect (Grok stays 4 s), the OpenCode plugin aborts the moment at 2 s, and settle stays 0.3 s. Installed hooks stay at 5 s. A slow or missing server still exits 0 with no body.
So what: This can merge. contextmd#56 also claims 0.5.6; whichever merges second rebases and bumps. The paired Cue wait is reviewed on chromeria#251.

Head matches the brief. One commit.

Checked, and consistent with the decision:

  • bin/contextmd-hook: deadline=2, Grok 4, curl --connect-timeout 1 -m "$deadline". Off file, missing credential, curl failure, and a non-200 all exit 0. Settle is a separate curl -m 0.3 after the reply is printed, so it is outside the 2 s cut and inside the 5 s hook.
  • contextmd/serve/opencode/contextmd.js: moment AbortSignal.timeout(2000), settle 300. plugin_source reads this file. A thrown abort returns null.
  • install.py still sets the command hook timeout to 5.

Proof, temp clone, not the main checkout:

  • OpenCodeCutoffTest and test_hooks_wait_two_seconds_and_grok_four pass (1.5 s reaches Claude and OpenCode; at 2.5 s Claude is empty in under 2.4 s and Grok still answers).
  • Same tests with the hook put back to deadline=1 and --connect-timeout 0.1, and the plugin to AbortSignal.timeout(1000), both fail: OpenCode gets [], Claude gets ''.

Non-blocking:

  • contextmd#56 also sets VERSION and CHANGELOG.md to 0.5.6. The second merge conflicts until it rebases.
  • Since 16:11Z, 3 of about 1,700 Cue-started pre-tool moments already took over 2 s of server time, so that tail still fail-opens. The 2 s hook is what was asked. Whether the 1.5 s Cue wait stays inside it is the finding on chromeria#251.

No private data. The only token in the diff is the test fixture "t". Not live-verified: I did not start Chromeria or use its ports.

@lukemaj

lukemaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

What: PASS: 8692515fe3835c632ae1e5c71f3252d4606c7f8e is a pure rebase of 293ba1e25c951469bd4c03bd0db1c885a4bf37f7, with version bookkeeping.
Why: The patch excluding VERSION and CHANGELOG.md is byte-identical, and all 119 tests pass.
So what: The independent rebase check is complete; the planner can use this verdict for the exact head.

Compared each commit against its parent. Both non-bookkeeping patches are 7,666 bytes, SHA-256 c1e2c21ea7636b527133e6fbd9ddc196954c044b01398f962a1710fa4c0148ff; only the VERSION and CHANGELOG.md patches differ. Version is 0.5.7. The new parent is #56's merge commit 8d496f4b7d8b19317de5b133483c5055622a8af6; head-tree differences in AGENTS.md and docs/map.md are inherited from that base.

Read-only review in /tmp/contextmd-review-58.V0Y4HD. CONTEXTMD_CHROMERIA=/tmp/chromeria-review-247.naggDa python3 -m unittest discover -s tests -t .: 119 tests, 36.101 s, OK, no skips. The initial run using the local Chromeria checkout failed during server setup; rerunning with the available dependency checkout above passed. No writes to ~/dev/toolboxmd/contextmd.

@lukemaj

lukemaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebase check of 8692515 (parent 8d496f4, main after #56) against 293ba1e.

The code patch is byte-identical. Only VERSION and CHANGELOG.md differ: 0.5.6 became 0.5.7, same note. The commit message is unchanged.

python3 -m unittest discover -s tests -t . at that SHA: 119 tests, OK (18 skipped, CONTEXTMD_CHROMERIA unset).

Verdict: pure rebase.

@lukemaj
lukemaj merged commit 27d21ed into main Oct 13, 2026
2 checks passed
@lukemaj
lukemaj deleted the fix/chromeria-248-serving-cutoff-2s branch October 13, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant