Skip to content

chore: agentic OS polish — coding rules and reliability fixes - #26

Merged
rgxdev merged 4 commits into
mainfrom
claude/nyxelos-agentic-polish-7h7k77
Jul 3, 2026
Merged

rgxdev merged 4 commits into
mainfrom
claude/nyxelos-agentic-polish-7h7k77

Conversation

@rgxdev

@rgxdev rgxdev commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

  • CLAUDE.md: persistent project-level AI coding rules (Conventional Commits, minimal/typed/secure code, no UI churn, targeted-only validation). A matching global ~/.claude/CLAUDE.md was also installed in this environment (not part of this repo/diff).
  • fix: truncate get_terminal_output before it enters model context — terminal_output returned a live terminal session's full buffer uncapped, unlike terminal_run/task_run/test_run, which already tail-slice to the last 4000/8000 chars. A long-running session's output could blow the model's context budget just from re-reading it. Now capped to the last 8000 chars, matching the existing pattern.
  • fix: prevent duplicate concurrent runs of the same automation — listDueAutomations only advances nextRunAt once the run fully completes, so an automation run that outlives one 30s scheduler poll tick was still "due" on the next tick and got dispatched a second time in parallel (same race let a manual runNow overlap a poll-triggered run). Added a process-local in-flight guard, mirroring the existing inFlightSyncs pattern in knowledge-base.ts, so a second concurrent dispatch is skipped instead of double-running the automation's agent/workflow.

Investigated but found already well-handled (no change needed): knowledge-base prompt-context injection already has a char budget + env-configurable caps; text_search/codebase_search/usages already cap aggregate output bytes; dead-letter/transient-retry handling and stale-run lease recovery already exist in agent-runtime.ts/scheduler.ts; approval resolution already uses an atomic CAS to prevent double-approval.

Files changed

  • CLAUDE.md (new)
  • apps/server/src/tools-builtin/read.ts
  • apps/server/src/tools-builtin/read.test.ts (new)
  • apps/server/src/scheduler.ts
  • apps/server/src/scheduler.test.ts

Test plan

  • bun test apps/server/src/tools-builtin/read.test.ts apps/server/src/tools-builtin/search.test.ts — pass
  • bun test apps/server/src/scheduler.test.ts — pass (5/5, including the new in-flight-guard test)
  • bunx turbo run typecheck --filter=./apps/server — pass
  • bunx biome check on all touched files — clean
  • Full suite / broad UI review — intentionally not run, per scope (targeted validation only)

Remaining risks

  • The automation in-flight guard is process-local only; it doesn't protect against duplicate dispatch across multiple server replicas in a multi-instance deployment (would need a DB-level atomic claim, out of scope for this pass).
  • get_terminal_output's new cap is a fixed 8000 chars (matching the existing task_run/test_run tail-slice constant); no configurability was added, consistent with "prefer simple truncation over complex summarization."

Generated by Claude Code

claude added 3 commits July 3, 2026 18:25
Project-level rules for Conventional Commits, minimal/typed/secure code,
no UI churn, and targeted-only validation.
terminal_output returned a live session's full buffer (up to
MAX_BUFFERED_CHARS) uncapped, unlike terminal_run/task_run/test_run which
already tail-slice their own output. A long-running session could blow
the context budget just from re-reading its output.
listDueAutomations only advances nextRunAt once finishAutomationRun
completes, so an automation run that outlives one 30s poll tick was still
"due" on the next tick and got dispatched a second time in parallel —
same race let a manual runNow overlap a poll-triggered run. Add a
process-local in-flight guard (mirrors knowledge-base.ts's inFlightSyncs)
so a second concurrent dispatch is skipped instead of double-running.
@rgxdev rgxdev changed the title Agentic OS polish: coding rules + two reliability fixes chore: agentic OS polish — coding rules and reliability fixes Jul 3, 2026
Pre-existing tabs vs. the project's 2-space format — untouched until this
PR's edit to buildTerminalOutputTool, at which point CI's --changed lint
gate now checks the whole file. Whitespace-only, no behavior change.
@rgxdev
rgxdev marked this pull request as ready for review July 3, 2026 18:27
@rgxdev
rgxdev merged commit 35df446 into main Jul 3, 2026
6 of 7 checks passed
@rgxdev
rgxdev deleted the claude/nyxelos-agentic-polish-7h7k77 branch July 3, 2026 18:27
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.

2 participants