Skip to content

fix: scan-3 triage — all 10 MAJOR findings fixed (Wave 1, issue #132) - #135

Merged
ajianaz merged 2 commits into
developfrom
fix/scan3-triage
Sep 28, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/scan3-triage

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What

All 10 MAJOR findings from the 2026-09-28 full cora scan (67 files), validated against the code and fixed with regression coverage where testable:

Why

The code landed after the previous full scan (#92/#93) and had never been scanned — the findings live in code written during the scan-3 wave, the ACP host, the MCP server, and the HTTP daemon.

Changes

  1. turn.rs resume: InvalidToolArgs intents (input = bare JSON string) are re-settled as errors on replay — never executed with the raw string; the Guarded block + execution now live in the object-only else branch
  2. turn.rs resume: opt-in pre-hooks apply on Guarded replay too (hook-deny was bypassable by crashing before settlement)
  3. subprocess: sh -c payloads starting with - are scanned (dash-stripped program lookup, conservative)
  4. storage: compact() marks the session poisoned when the post-rename reopen fails — commits fail loudly instead of vanishing into an unlinked inode
  5. openai: tool settlements verify the parent entry is an INTENT before emitting a tool message
  6. serve: request-line + headers capped at 32 KiB (pre-auth memory DoS)
  7. session_host: new_session_id gains a monotonic counter suffix (ms+pid collisions silently overwrote sessions)
  8. serve: sessions capped at 256 with non-busy eviction (durable files preserved — only in-memory handles evicted)
  9. main.rs: global --workspace/--memory now flow into serve/acp/mcp as fallbacks (previously silently ignored)
  10. test renamed to match verified behavior (both abort flavors)

Closes #132 (Wave 1). Wave 2 (serve hardening) is #133; release #134.

Testing

  • fmt / clippy -D warnings / test --workspace ✅ (239 tests)
  • cora review --staged: No issues found (after it caught two residuals in my own first pass — the malformed-args fall-through and the missing global-memory fallback — both fixed)
  • Live E2E: ACP + serve behavior unchanged (session creation, prompts, busy-409 verified in earlier rounds on the same code paths)

1. turn.rs resume: InvalidToolArgs intents (input = bare JSON string)
   are re-settled as errors on replay — never executed with the raw
   string. The Guarded-replay block (approver consult, pre-hook deny)
   and the execution now live inside the object-only else branch.
2. turn.rs resume: opt-in pre-hooks apply on Guarded replay too (the
   hook-deny was bypassable by crashing before settlement).
3. subprocess: sh -c payloads starting with '-' are scanned (leading
   dash on the program token is dash-stripped conservatively).
4. storage: compact() marks the session poisoned when the post-rename
   reopen fails — commits fail loudly instead of vanishing into an
   unlinked inode.
5. openai: tool settlements verify the parent entry is an INTENT before
   emitting a tool message on the wire.
6. serve: request-line + headers capped at 32 KiB (pre-auth memory DoS).
7. session_host: new_session_id gains a monotonic counter suffix (ms+pid
   collisions silently overwrote sessions).
8. serve: sessions capped at 256 with non-busy eviction (long-running
   daemon growth).
9. main.rs: global --workspace/--memory now flow into serve/acp/mcp as
   fallbacks (previously silently ignored).
10. test renamed to match verified behavior (both abort flavors).

MINOR/INFO findings (test hygiene, non-unix paths, evals python) were
addressed in the same pass where touched; the remainder are cosmetic
and tracked on the branch.
Comment thread crates/tole-cli/src/serve.rs Outdated
let oldest = sessions
.map
.iter()
.filter(|(_, st)| !*st.busy.lock().expect("busy lock"))
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

CodeCora scan round-2: the eviction filter called busy.lock().expect()
while holding the sessions map lock — a turn mid-flight (busy held for
the entire LLM call) would block POST /sessions for the turn's whole
duration, stalling every other route that needs the map. try_lock now
skips locked-busy sessions without blocking; all-busy at capacity
returns 503.
@ajianaz
ajianaz merged commit a29d698 into develop Sep 28, 2026
18 of 19 checks passed
@ajianaz
ajianaz deleted the fix/scan3-triage branch September 28, 2026 08:36
ajianaz added a commit that referenced this pull request Sep 29, 2026
… provider-failure recovery (#106, #85, #84)

#106 — Cargo.lock committed (rmcp pinned at the verified 3.4.0) and
removed from .gitignore: CI resolved fresh every run while local
machines carried stale locks — 'what compiles' depended on WHEN you
resolved, not the commit. Fresh clone → cargo build --workspace now
reproduces CI's dependency set deterministically (verified from a
clean clone).

#85 — loop guard poll exemption: job_poll with identical input is the
CORRECT pattern (arguments name the job; the RESULT carries the
change) — the old guard aborted healthy 14-minute-render missions at
the 3rd poll. Poll tools now trip at 120 (patience ceiling, still
guards a true stuck-poll); non-poll tools trip at 3 unchanged.
Regression test: 25 identical polls complete; identical non-poll calls
still trip. Live-verified: a 16s detached job polled 6 times to
completion, no trip.

#84 — terminal provider failures now SETTLE the turn (Planning→Final
with a durable error record) instead of wedging at pc=Planning: a
plain 'tole resume <id> "prompt"' works next, matching the E5
crash-resume guarantee. (The malformed-intent replay guard — the other
half of the original wedge — landed with the scan-3 triage #135.)
Tests updated to the new contract: provider-failure lands Final and
the follow-up turn drives cleanly; the mid-flight refusal test now
constructs its wedge state directly. Live-verified: connection-refused
failure → pc Final → prompt resume answers RECOVERED.
ajianaz added a commit that referenced this pull request Sep 29, 2026
… provider-failure recovery (#106, #85, #84) (#140)

#106 — Cargo.lock committed (rmcp pinned at the verified 3.4.0) and
removed from .gitignore: CI resolved fresh every run while local
machines carried stale locks — 'what compiles' depended on WHEN you
resolved, not the commit. Fresh clone → cargo build --workspace now
reproduces CI's dependency set deterministically (verified from a
clean clone).

#85 — loop guard poll exemption: job_poll with identical input is the
CORRECT pattern (arguments name the job; the RESULT carries the
change) — the old guard aborted healthy 14-minute-render missions at
the 3rd poll. Poll tools now trip at 120 (patience ceiling, still
guards a true stuck-poll); non-poll tools trip at 3 unchanged.
Regression test: 25 identical polls complete; identical non-poll calls
still trip. Live-verified: a 16s detached job polled 6 times to
completion, no trip.

#84 — terminal provider failures now SETTLE the turn (Planning→Final
with a durable error record) instead of wedging at pc=Planning: a
plain 'tole resume <id> "prompt"' works next, matching the E5
crash-resume guarantee. (The malformed-intent replay guard — the other
half of the original wedge — landed with the scan-3 triage #135.)
Tests updated to the new contract: provider-failure lands Final and
the follow-up turn drives cleanly; the mid-flight refusal test now
constructs its wedge state directly. Live-verified: connection-refused
failure → pc Final → prompt resume answers RECOVERED.

Co-authored-by: ajianaz <[email protected]>
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.

fix: scan-3 triage — 10 MAJOR findings from the 2026-09-28 full scan (Wave 1)

2 participants