Repository navigation
Conversation
3dbb21e to
02b08dd
Compare
65dd134 to
3b84259
Compare
406afee to
59d19df
Compare
54afe2e to
660a09e
Compare
3c216d2 to
5b21865
Compare
4341c86 to
a45299f
Compare
2398b85 to
77c909c
Compare
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1726 at |
58ae208 to
fb4ac91
Compare
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1726 at |
fb4ac91 to
9ee19a5
Compare
Round-7 F2 (captain-approved; F1/F3 stay declined): consolidate the duplicated exact PID+identity termination logic (parse record, liveness, identity revalidation, TERM-wait-KILL-revalidate, refuse-on-survival) into fm_process_record_terminate in bin/fm-process-identity-lib.sh, the shared owner both spawn and teardown already source. Caller policy stays outside the primitive: malformed-record action (spawn refuse / teardown remove), timings (--term-polls/--poll-interval), retention on confirmed termination (--keep-record for the harness-switch path), lifecycle diagnostics (--verbose), and refusal diagnostics (callers phrase from FM_PROCESS_RECORD_TERMINATE_REASON). The round-4 rollback-retention and round-5 preserve-on-unconfirmed contracts hold: every refusal preserves the record, removal happens only after the process is proven gone or its identity no longer matches. Exit-race tolerance: a process dying from TERM/KILL can still answer kill -0 while /proc/<pid> is already gone, so mid-wait identity-read failures recheck liveness instead of refusing; only a persistent alive-but-unreadable process refuses. spawn's cursor_worker_server_reap_record and teardown's reap_cursor_worker_server are now thin wrappers over it.
…rmed teardown case
…ling races
Root cause (reproduced under throttled CPU, matching the CI failure signature): the hung-successor and unretired-successor fixtures raced the extension's wall-clock budgets under scheduling contention. (1) The spawned 'bash -lc' successor can take hundreds of ms to start (login profile sourcing on a starved runner), so the 250 ms readiness window could SIGTERM it before its script ran - the arm log lost rows and the exact-4-rows assertion failed ('expected one successor plus two retries, got N'). (2) SIGTERM-to-close observation could exceed the 250 ms retirement budget, taking the 'did not exit within 250ms' early-return path. Both budgets now carry real slack (750 ms, ~5x the observed CI per-attempt latency) while keeping the loop at ~2.5 s; retirement stays deliberately tiny (20 ms) in the unretired tests whose fixtures ignore TERM. The prompt fail-loud cap is 10 s (worst-case paced flow approaches 5 s) and the single-flight stability check waits a bounded 100 ms window covering the 5-10 ms retry delay instead of one event-loop turn. Every inner failure now surfaces the captured Node output. A second real bug found while stress-testing: the OpenCode turn-end guard plugin crashed on an unhandled EPIPE when a fast-exiting guard child closed its stdin before the payload write landed - the stdin error is now handled.
cursor_worker_server_record now writes pid+identity atomically to a dedicated state/<id>.worker-server file via temp+mv instead of appending two separate lines to the meta file. On discovery timeout or missing identity, the function returns 1 instead of 0. The spawn caller checks the return and rolls back the endpoint (kills the backend pane, removes the partial record, writes failed status). teardown reap_cursor_worker_server reads from the atomic record file instead of grepping meta. remove_cursor_worker_server_record is replaced by direct rm of the record file. Tests: absent-record now expects refusal (was success); added regression tests for discovery timeout rollback, atomic record completeness, and detached-worker identification. probe-based alias fallback added to cursor_process_matches to match the resolver behaviour. Finding kunchenguid#1 from code-judo review PR kunchenguid#1726.
…ed hook-arm primitive
Extract the hook-owned arm lifecycle into bin/fm-hook-arm-lib.sh with
canonical functions: fm_hook_arm_foreground, fm_hook_arm_has_actionable,
fm_hook_arm_wake_reason, fm_hook_arm_interrupted_park_reason, and
fm_hook_arm_canonical_reason. The shared lib is the single owner of the
arm+classify+healthy-watcher decision tree.
Rename .cursor-hook-interrupted to .hook-arm-interrupted (harness-neutral)
across fm-watch-arm.sh, fm-wake-drain.sh, fm-turnend-guard-cursor.sh,
docs, and tests. Remove the Cursor-specific comment from the generic
watcher and drain scripts.
Rewrite fm-turnend-guard-cursor.sh (398->343 lines) to use the shared
primitive. The adapter now does: parse Cursor payload, derive session
identity, call canonical arm operation, apply bounded continuation
counter (Cursor-specific, ~140 lines), translate to {} or followup_message.
Finding kunchenguid#2 from code-judo review PR kunchenguid#1726.
…econd herdr regex Declare Cursor-specific composer constants (prompt glyph, idle placeholder regex, Enter-while-busy capability) once near the top of fm-composer-lib.sh instead of hardcoding them inline and in backend files. Remove FM_BACKEND_HERDR_BARE_PROMPT_CURSOR_RE from herdr.sh. The scanner now builds the prompt regex dynamically by appending the Cursor glyph to the base alternation when FM_COMPOSER_HARNESS=cursor, so the glyph is defined once in the composer lib, not duplicated in the backend. Finding kunchenguid#3 from code-judo review PR kunchenguid#1726. The ANSI reverse-video gap buffering extraction from fm_composer_strip_ghost is deferred to a follow-up; the current harness gate and comments document the boundary.
Move Cursor-specific test functions (872 lines) from the shared tests/fm-turnend-guard.test.sh into tests/fm-turnend-guard-cursor.test.sh. The shared guard suite sources the new file so the test list entries still resolve. Shared contract/integration cases, the Claude-hermetic-under-Cursor test, and genuinely reusable helpers stay in the original file. No test function bodies are changed; this is a pure move. Finding kunchenguid#4 from code-judo review PR kunchenguid#1726.
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1726 at |
|
Superseded by #2224: the Cursor adapter continues on a clean rebase onto current main. |
Intent
Add first-class Cursor harness support to firstmate so Cursor workers can be detected, launched, supervised, and cleaned up safely across local and remote execution. Extend primary-session supervision and shared interaction handling for Cursor's process, hook, prompt, and worker-server behavior while preserving existing harness behavior.
What Changed
stopandpreToolUsehooks with deny responses, turn-end supervision, continuation re-arming, bounded wake chains, and follow-up handling.bin/fm-cursor-lib.sh.Pipeline
Updates from git push no-mistakes
✅ Intent - passed
✅ Rebase - passed
✅ Review - completed
✅ Test - passed
✅ Document - passed
✅ Lint - passed
✅ Push - passed