Skip to content

fix: remaining CodeCora scan findings — full sweep - #93

Merged
ajianaz merged 1 commit into
developfrom
fix/scan-deferred
Sep 18, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/scan-deferred

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What

All remaining MINOR/INFO findings from the 2026-09-18 full cora scan, fixed directly (maintainer call: no tracking issue). 19 files, includes one structural improvement and one new root-cause bug found by live E2E of this very sweep.

Why

The scan's deferred findings were real hygiene/correctness issues; fixing them now keeps the codebase scan-clean without a permanent findings ledger.

Changes

Provider wire: scrub() no-op on empty secret; non-string tool_call arguments serialized instead of replaced with {}; one ureq agent per provider (connection reuse).

NEW root-cause (live E2E): write_file was the ONLY registered tool without a spec() override — providers received a property-less schema and GLM legally answered arguments: {} (every call failed 'missing path', loop guard tripped). Spec now declares path+content required; regression test pins the schema.

CLI host: failed startups no longer leave a stray empty session file; resume <id> "<prompt>" stores the memory summary; chat explicitly reports a dropped message after exhausted retries; session ids use strip_suffix; binary_available honors exec bit/.exe; tole-cli is now lib+bin so approval_flow integration tests drive the REAL jailed tools + approver (scan's parity finding, fixed structurally).

Core tools: edit_file approval line shows the actual old→new change; temp files unique per attempt + legacy stale sweep; delete_file on a symlink removes the LINK, not the referent; job_start kills the job if the pid file can't be written; MCP description truncation streams (no full payload copy); transport-error class shares one constant.

Docs/evals/tests: architecture principle 4 + cross-build rows current; threat-model ENV-1/JOB-2 rows match the code; Tier 2 runner Python 3.9-compatible + mkdtemp cleanup + portable timestamp + diff scope fixes; test hygiene (tmpdir clears stale state, abort outcome asserted not discarded, &Path, unix gating, dead counter removed).

Dismissed with evidence: gh read ops returning raw gh --json stdout (the model parses it fine); session-listing full replay (correctness first, session counts small); Ctrl-C skipping the memory summary (no signal handler in scope; the session log itself is durable); PID-recycling false liveness (self-heals on next poll; job ids are per-session); PRD/epics historical risk-tier wording (point-in-time planning artifacts); architecture open-question rows (documented considerations, not defects).

Testing

  • fmt / clippy -D warnings / test --workspace ✅ (197 tests)
  • python: py_compile both evals scripts ✅
  • Live E2E (release binary): write → edit (hash self-correct) → read → git commit, all green in a sandbox repo; memory loop intact; cora preset intact
  • cora review --staged: No issues found

Deferred MINOR/INFO findings from the 2026-09-18 full cora scan, fixed
directly (per maintainer call: no tracking issue):

Provider wire:
- openai: scrub() is a no-op for an empty secret (replace('') mangled
  the whole message); non-string tool_call arguments are serialized
  instead of silently replaced with '{}'; one ureq agent per provider
  (connection reuse) instead of a fresh agent per request.

CLI host:
- NEW root-cause fix found by live E2E of this sweep: write_file was
  the ONLY registered tool without a spec() override — providers got a
  property-less schema and GLM legally answered arguments:{} (missing
  'path' every call; loop guard tripped). Spec declares path+content;
  regression test pins the schema.
- failed startups no longer leave a stray empty session file (registry/
  provider are built before the session is created, run + chat).
- resume <id> "<prompt>" stores the memory summary like run does.
- chat says explicitly when a typed message was dropped after exhausted
  mid-flight retries (the old copy implied it was recorded).
- session ids use strip_suffix (x.jsonl.jsonl no longer yields an
  unusable id); binary_available honors the executable bit (unix) and
  .exe (windows).
- tole-cli is now lib+bin: approval_flow integration tests drive the
  REAL jailed WriteFileTool and InteractiveApprover instead of drifting
  re-implementations (the scan's parity finding, fixed structurally).

Core tools:
- edit_file's approval line shows the actual old→new change (bounded
  previews), not just the file name.
- edit_file temp files are unique per attempt (pid+nanos) and legacy
  pid-only stale temps are swept up front — self-heal can no longer
  race a concurrent same-pid writer.
- delete_file on a symlinked path removes the LINK, not the referent
  the jail canonicalized to.
- job_start kills the spawned job when the pid file cannot be written
  (no untracked orphan reporting failure).
- mcp: tool-request descriptions truncate by streaming (no full
  Vec<char> of the payload); transport-error class shares one constant.

Docs/evals:
- architecture.md principle 4 + cross-build rows updated (CI landed).
- threat-model ENV-1 row now lists the real scrub set (_TOKEN,
  PASSWORD included); JOB-2 row matches the post-triage read-only poll.
- evals Tier 2 runner: Python 3.9-compatible annotations, mkdtemp
  session dirs cleaned, portable ISO timestamp, baseline diff keeps
  improvements out of regressions and notes zero baselines.
- tests: jsonl tmpdir clears stale state, turn_loop asserts the abort
  outcome instead of discarding it, cora_search timeout tests unix-
  gated, evals_tier1 takes &Path, approver dead counter removed.

Dismissed with evidence (see PR body): gh read ops raw stdout, session
listing full replay cost, Ctrl-C summary skip, PID-recycling liveness,
PRD/epics historical risk-tier wording, architecture open-question
rows.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit db39138 into develop Sep 18, 2026
16 checks passed
@ajianaz
ajianaz deleted the fix/scan-deferred branch September 18, 2026 06:56
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