Skip to content

Restore the test suite and satisfy Credo strict - #22

Merged
gofenix merged 3 commits into
mainfrom
cursor/fix-test-suite-813d
Nov 11, 2026
Merged

gofenix merged 3 commits into
mainfrom
cursor/fix-test-suite-813d

Conversation

@gofenix

@gofenix gofenix commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Summary

Makes mix format --check-formatted, mix credo --strict, and MIX_ENV=test mix test pass on Elixir 1.19.4 / OTP 28.2. Formatting, behavior fixes, and Credo refactors are separate commits. No tests were deleted or skipped. No Credo checks were disabled, and no credo:disable comments were added.

Formatting

  • mix format only (9ebc0ac). No logic change.

Runtime identity

  • Tests updated. The runtime copy in ffc5555 intentionally dropped the default "Nex Agent" persona in favor of workspace layers (SOUL.md and the rest). Assertions now match ## Runtime Identity and "No default persona is imposed by the runtime."

Memory status

  • Tests updated. ffd5628 replaced the old ready/blocked/threshold payload with pending / idle / running / queued / unknown and reasons such as unreviewed_messages. The stale-consolidation test now checks that legacy flags do not change that status.

Memory refresh prompt

  • Tests updated. The prompt heading is ## Conversation to Process.

Memory tool descriptions

  • Tests updated. The tool text is "trigger memory refresh" / "立即更新记忆".

Heartbeat evolution

  • Code restored. Daily and weekly evolution callers were removed while the state fields and {:weekly_evolution_done, ...} handler remained. Failed cycles are recorded again, and a failed weekly cycle does not advance the cooldown.

Correction signals

  • Code restored. Runner again records correction and tool-error signals before enqueueing a memory refresh.

Evolution counter

  • Code restored. A successful memory refresh increments the evolution counter and can start a cycle. The memory mock LLM is not reused for that cycle.

Skill discovery

  • Code restored. Package search text includes manifest.content again, so body words such as "operations checklist" are discoverable. The registry still only loads rt__ and gh__ directories.

Memory refresh queue

  • Code fixed. The app-wide MemoryUpdater could stay stuck on current when a job exited without {:job_finished, ...} (the prompt-heading crash did this and then blocked later refreshes, including inbound and runner tests). Jobs are monitored by reference, and exceptions are turned into {:error, ...} before the next job starts.

Credo

  • Code refactored only, in e16efdb. Behavior is unchanged.
  • Single-condition cond became if (memory, request_trace, runner, validator, feishu_task).
  • with that only forwarded one clause became case, or the final call moved into the do block (feishu, github_project_poller, skills, tasks, skill_get, validator).
  • Enum.map |> Enum.join became Enum.map_join, and two Enum.filter passes became one (evolution, runner, opencode_run, store, validator, tasks, personal_summary).
  • if not enabled? was flipped (skill_runtime). is_openrouter_endpoint?/1 was renamed to openrouter_endpoint?/1.
  • Direct Config.request_trace/1 and Config.skill_runtime/1 calls replaced apply/3. Both functions exist.
  • InboundWorker.dispatch_async/6 (complexity 28, max 25) and Message.execute/2 were split into helpers. SkillRuntime.prepare_run/2 was split so nesting stays within 5, and selection still stops before importing another package once max_selected is reached.

Verification

Local CI sequence from .github/workflows/ci.yml:

  • mix format --check-formatted passed
  • mix credo --strict passed
  • MIX_ENV=test mix test --seed 0: 250 tests, 0 failures
  • mix dialyzer still exits 2 with the same 51 warnings as the parent commit (line numbers shift only where this branch edited a file). Those warnings are pre-existing, including unused helpers in skill_runtime/evolver.ex and pattern mismatches in knowledge.ex, admin.ex, and feishu.ex. They were not added to .dialyzer_ignore.exs.

Do not merge; this is ready for review.

Open in Web Open in Cursor 

cursoragent and others added 3 commits November 11, 2026 02:56
Co-authored-by: Jeff <gofenix@users.noreply.github.com>
Heartbeat again records failed daily and weekly evolution cycles, and a failed weekly cycle does not advance its cooldown. The runner records correction signals, successful memory refreshes increment the evolution counter, and skill search includes package content again. MemoryUpdater keeps the refresh queue moving when a job task exits.

Tests now follow the current runtime identity copy, memory status payload, refresh prompt heading, and memory tool descriptions.

Co-authored-by: Jeff <gofenix@users.noreply.github.com>
Rewrite single-clause conditionals, redundant with clauses, and
over-complex functions so the configured Credo checks pass. No checks
were disabled and no credo:disable comments were added.

Co-authored-by: Jeff <gofenix@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T04:33:24.681715Z e16efdb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@gofenix
gofenix merged commit 8ec412f into main Nov 11, 2026
1 check failed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e16efdb1f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/nex/agent/memory.ex
Comment on lines +508 to +512
|> Keyword.take([
:workspace,
:provider,
:model,
:api_key,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Forward the refresh provider and model to evolution

When a session uses a provider or model different from the global configuration, every fifth successful refresh starts evolution with the wrong LLM configuration. MemoryUpdater.run_job/1 passes provider and model as positional arguments to Memory.refresh/4, not in opts, so taking these keys here never captures them. Evolution.resolve_runtime_llm_opts/1 consequently falls back to the global provider/model while retaining the session's API key and base URL, causing authentication or unsupported-model failures. Pass the effective positional provider and model into the evolution options.

Useful? React with 👍 / 👎.

Comment thread lib/nex/agent/memory.ex
Comment on lines +518 to +519
_ = Nex.Agent.Evolution.maybe_trigger_after_consolidation(evolution_opts)
outcome

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize automatic evolution with subsequent memory refreshes

When another refresh is queued for the same workspace, this new hook can silently lose evolution's memory updates. maybe_trigger_after_consolidation/1 launches an asynchronous task and returns immediately, allowing MemoryUpdater to start the next job. That job snapshots MEMORY.md before its LLM call; if evolution appends a memory update while that call is running, the refresh subsequently replaces the entire file with a result based on the older snapshot, erasing the appended update despite a successful evolution audit entry. Coordinate evolution writes with the workspace's refresh queue, or otherwise prevent stale refresh results from overwriting concurrent updates.

Useful? React with 👍 / 👎.

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