Skip to content

fix(agents): restore controllable background sessions - #21

Merged
w0wl0lxd merged 8 commits into
mainfrom
fix/task-almas-preview
Jul 20, 2026
Merged

w0wl0lxd merged 8 commits into
mainfrom
fix/task-almas-preview

Conversation

@w0wl0lxd

Copy link
Copy Markdown
Owner

Summary

  • keep task, almas, and the new agent_control tool available together
  • open task/ALMAS subagent chats by clicking their tool cards
  • remove the permanent status-bar thinking... indicator; reasoning remains in expandable chat disclosures
  • remove the misleading partial HALO prompt-refinement implementation
  • fix task async completion so long subagents do not fail with handler returned nil without calling ctx:finish()
  • add background=true to task and ALMAS, returning an agent_id
  • add agent_control actions to list, inspect, steer, and stop background agents

Verification

  • nix develop -c cargo nextest run -p n00n-lua -p n00n-ui -p n00n-config — 1961 passed
  • nix develop -c cargo clippy -p n00n-lua -p n00n-ui -p n00n-config --all-targets -- -D warnings
  • nix develop -c just gen-docs
  • built-in tool smoke test confirms agent_control, almas, and task coexist

Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@w0wl0lxd, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d7c9487-bd55-4abc-a57b-f283723db745

📥 Commits

Reviewing files that changed from the base of the PR and between cedd72a and 60479d6.

📒 Files selected for processing (5)
  • n00n-lua/src/api/session.rs
  • n00n-lua/src/api/util/command.rs
  • n00n-ui/src/event_loop.rs
  • plugins/agent_control/init.lua
  • site/docs/content/lua-api/_index.md
📝 Walkthrough

Walkthrough

The pull request replaces the ALMAS plugin surface with Team, adds background-agent control and session cancellation, refactors task execution, updates Team orchestration, expands agent-focused UI behavior, and refreshes related tests and documentation.

Changes

Team and agent orchestration

Layer / File(s) Summary
Plugin surface and Team rename
AGENTS.md, n00n-config/..., n00n-lua/src/loader.rs, plugins/team/*, site/docs/content/tools/*
Built-in registration, commands, storage paths, launchers, tests, scripts, and documentation now use Team; agent_control is bundled.
Session cancellation API
n00n-lua/src/api/session.rs, n00n-lua/src/api/util/command.rs, n00n-ui/src/event_loop.rs
Adds n00n.session.cancel(id), forwards SessionRequest::Cancel, validates live sessions, and cancels the current run.
Background task and agent control
plugins/task/init.lua, plugins/agent_control/init.lua, n00n-lua/tests/task_policy.rs
Adds background task sessions, task timeouts, synchronous lifecycle handling, and agent list/status/message/stop actions.
Team planning and execution
plugins/team/ibn.lua, plugins/team/init.lua
Adds tier-based fan-out decisions, bounded plans, failure-aware execution, background launching, and swarm limits.
Agent picker and cancellation UI
n00n-ui/src/app/*, n00n-ui/src/chat.rs, n00n-ui/src/components/*
Adds tool-session lookup, agent labels and usage details, cancellation delegation, and updated status rendering.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • w0wl0lxd/n00n#12: Deletes the ALMAS refinement module and changes built-in plugin naming.
  • w0wl0lxd/n00n#20: Also changes plugins/task/init.lua task execution and completion behavior.

Poem

A rabbit hops where Team tools bloom,
Background agents dash from the room.
“Stop!” says the carrot, “cancel with care,”
Plans share their results through the air.
ALMAS shed its old costume bright—
Team now guides the moonlit night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: restoring controllable background sessions for agents.
Description check ✅ Passed The description is clearly related to the changeset and summarizes the new background-session and agent-control behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/task-almas-preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces background agent control capabilities, including a new agent_control plugin to list, inspect, steer, or stop background agents started by task or ALMAS. It also implements a cancel function in the Lua API and UI event loop to cancel the current turn of a live session, allows users to switch active chats by clicking on tool segments in the UI, and removes the adaptive prompt refinement (refine.lua) from ALMAS. Reviewer feedback suggests allowing cancellation of sessions in states other than Working (such as NeedsInput) by checking that the session is not Idle, and using a dynamic forwarded table pattern in the task plugin's background handler to improve maintainability.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread n00n-ui/src/event_loop.rs Outdated
Comment thread plugins/task/init.lua Outdated
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
@w0wl0lxd
w0wl0lxd marked this pull request as ready for review July 20, 2026 14:12

@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: 64b4d4b5dd

ℹ️ 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 plugins/agent_control/init.lua
w0wl0lxd added 6 commits July 20, 2026 10:37
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
Signed-off-by: w0wl0lxd <w0wl0lxd@tuta.com>
@w0wl0lxd
w0wl0lxd merged commit 82cc3d7 into main Jul 20, 2026
11 of 12 checks passed

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/task/init.lua`:
- Around line 151-165: Replace the background branch in the task handler with
the same detached subagent creation flow used by the synchronous path, invoking
n00n.agent.session(...) directly instead of creating a session with a
natural-language prompt. Preserve the background response contract while
ensuring subagent audience setup, early output_schema validation, and semaphore
gating occur during the initial spawn.
- Around line 277-297: Handle the result of the do_poll coroutine after
n00n.async.gather, rather than ignoring results[2]. If polling failures are not
best-effort, propagate results[2].err so the task fails; otherwise explicitly
log the polling error while preserving the existing prompt result handling.

In `@plugins/team/ibn.lua`:
- Around line 17-25: Update is_multi_step to match each MULTI_STEP keyword only
at a word boundary using Lua’s frontier pattern %f[%a], while preserving case
normalization and literal matching so substrings within larger words no longer
trigger a multi-step result.

In `@plugins/team/init.lua`:
- Line 396: Rename the unused input parameter in the finish_run function to
_input, preserving its position and all other parameters and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 23f3af1f-eff6-4e35-bd88-60372c553b34

📥 Commits

Reviewing files that changed from the base of the PR and between e729ee1 and cedd72a.

📒 Files selected for processing (36)
  • AGENTS.md
  • n00n-config/src/lib.rs
  • n00n-docgen/src/gen_tools.rs
  • n00n-lua/src/api/agent.rs
  • n00n-lua/src/api/session.rs
  • n00n-lua/src/api/util/command.rs
  • n00n-lua/src/loader.rs
  • n00n-lua/tests/plugin_host.rs
  • n00n-lua/tests/spec.rs
  • n00n-lua/tests/task_policy.rs
  • n00n-ui/src/app/mod.rs
  • n00n-ui/src/app/mouse.rs
  • n00n-ui/src/app/tests.rs
  • n00n-ui/src/chat.rs
  • n00n-ui/src/components/command.rs
  • n00n-ui/src/components/messages/mod.rs
  • n00n-ui/src/components/messages/tests.rs
  • n00n-ui/src/components/status_bar.rs
  • n00n-ui/src/event_loop.rs
  • plugins/agent_control/init.lua
  • plugins/almas/refine.lua
  • plugins/lib/n00n/route_tier.lua
  • plugins/task/init.lua
  • plugins/team/ibn.lua
  • plugins/team/init.lua
  • plugins/team/mem.lua
  • plugins/team/quorum.lua
  • plugins/team/retrieve.lua
  • plugins/team/roles.lua
  • plugins/team/swarm.lua
  • plugins/team/tests/spec.lua
  • scripts/team_demo.sh
  • site/docs/content/commands/_index.md
  • site/docs/content/configuration/_index.md
  • site/docs/content/lua-api/_index.md
  • site/docs/content/tools/_index.md
💤 Files with no reviewable changes (2)
  • plugins/almas/refine.lua
  • plugins/team/tests/spec.lua
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Lint (Windows)
  • GitHub Check: Build (Windows)
  • GitHub Check: Test
🧰 Additional context used
📓 Path-based instructions (7)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Avoid unnecessary state, including variables, fields, and arguments; each line of code should justify its existence.
Follow Rust idioms and best practices, using current stable Rust features where appropriate.
Use descriptive variable and function names.
Do not use wildcard imports.
Import types at the top of the file and use short names instead of fully qualified inline paths.
Keep constants at the top of the file, immediately after imports.
Use explicit error handling with Result<T, E> instead of panics.
Use color_eyre when the specific error is not important, and use custom thiserror error types for domain-specific errors.
Place unit tests in the same source file inside #[cfg(test)] modules.
Be mindful of allocations in hot paths.
Prefer structured logging with useful fields.
Provide helpful error messages.
Use #[test_case] for tests and snake_case names for test functions.
Do not add tautological or otherwise pointless tests.
Ensure tests are deterministic and do not use arbitrary sleeps.
Do not use inline magic numbers or strings.
In tests, define error and status messages as constants and assert against the shared constants.
Add #[derive(Copy)] only to structs with one primitive field.
Run cargo clippy --all --tests -- -D warnings and cargo nextest run --workspace to validate changes.

Files:

  • n00n-lua/src/api/agent.rs
  • n00n-ui/src/components/command.rs
  • n00n-lua/tests/spec.rs
  • n00n-ui/src/chat.rs
  • n00n-ui/src/components/messages/mod.rs
  • n00n-ui/src/event_loop.rs
  • n00n-lua/src/api/util/command.rs
  • n00n-ui/src/components/messages/tests.rs
  • n00n-lua/tests/plugin_host.rs
  • n00n-ui/src/components/status_bar.rs
  • n00n-lua/src/api/session.rs
  • n00n-lua/src/loader.rs
  • n00n-docgen/src/gen_tools.rs
  • n00n-ui/src/app/mod.rs
  • n00n-ui/src/app/mouse.rs
  • n00n-config/src/lib.rs
  • n00n-ui/src/app/tests.rs
  • n00n-lua/tests/task_policy.rs
n00n-lua/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Keep the Lua plugin system, with a Neovim-compatible API, in n00n-lua.

Files:

  • n00n-lua/src/api/agent.rs
  • n00n-lua/tests/spec.rs
  • n00n-lua/src/api/util/command.rs
  • n00n-lua/tests/plugin_host.rs
  • n00n-lua/src/api/session.rs
  • n00n-lua/src/loader.rs
  • n00n-lua/tests/task_policy.rs
plugins/**/*.lua

📄 CodeRabbit inference engine (AGENTS.md)

Keep built-in Lua plugins under ./plugins and preserve the listed plugin responsibilities.

Files:

  • plugins/team/retrieve.lua
  • plugins/lib/n00n/route_tier.lua
  • plugins/team/ibn.lua
  • plugins/team/mem.lua
  • plugins/team/swarm.lua
  • plugins/team/quorum.lua
  • plugins/agent_control/init.lua
  • plugins/team/roles.lua
  • plugins/task/init.lua
  • plugins/team/init.lua
n00n-ui/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Implement the n00n-ui crate using ratatui and an Elm-like architecture.

Files:

  • n00n-ui/src/components/command.rs
  • n00n-ui/src/chat.rs
  • n00n-ui/src/components/messages/mod.rs
  • n00n-ui/src/event_loop.rs
  • n00n-ui/src/components/messages/tests.rs
  • n00n-ui/src/components/status_bar.rs
  • n00n-ui/src/app/mod.rs
  • n00n-ui/src/app/mouse.rs
  • n00n-ui/src/app/tests.rs
site/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Write user documentation in a warm, simple, concise, story-telling style suitable for non-native English readers; avoid em dashes, emojis, and AI-like tone.

Files:

  • site/docs/content/commands/_index.md
  • site/docs/content/configuration/_index.md
  • site/docs/content/tools/_index.md
  • site/docs/content/lua-api/_index.md
n00n-docgen/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Generate site documentation through the gen_*.rs generators and run just gen-docs after documentation changes.

Files:

  • n00n-docgen/src/gen_tools.rs
n00n-config/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Keep user-configuration functionality in n00n-config.

Files:

  • n00n-config/src/lib.rs
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: w0wl0lxd/n00n

Timestamp: 2026-07-20T15:24:52.489Z
Learning: Avoid trivial comments.
Learnt from: CR
Repo: w0wl0lxd/n00n

Timestamp: 2026-07-20T15:24:52.489Z
Learning: Keep implementations minimal and avoid unnecessary bloat; follow KISS, DRY, and SRP.
🪛 Luacheck (1.2.0)
plugins/team/init.lua

[warning] 396-396: unused argument 'input'

(W212)

🔇 Additional comments (32)
site/docs/content/configuration/_index.md (2)

83-83: LGTM!


219-226: 📐 Maintainability & Code Quality

Workflow timeout default matches runtime.
plugins.workflow.timeout_secs already uses DEFAULT_TIMEOUT_SECS = 600, so the docs stay aligned.

n00n-lua/src/api/util/command.rs (1)

396-396: LGTM!

n00n-lua/src/api/session.rs (1)

146-158: LGTM!

Also applies to: 186-186, 231-252

n00n-ui/src/app/mod.rs (1)

97-98: LGTM!

Also applies to: 489-513, 974-977

n00n-ui/src/event_loop.rs (1)

736-749: LGTM!

n00n-lua/src/api/agent.rs (1)

148-148: LGTM!

plugins/lib/n00n/route_tier.lua (1)

4-4: LGTM!

n00n-ui/src/app/mouse.rs (1)

75-85: LGTM!

site/docs/content/lua-api/_index.md (1)

826-826: LGTM!

Also applies to: 2622-2637, 4891-4891

n00n-ui/src/chat.rs (1)

282-285: LGTM!

n00n-ui/src/components/messages/mod.rs (1)

719-730: LGTM!

n00n-ui/src/components/command.rs (1)

27-27: LGTM!

AGENTS.md (1)

53-53: LGTM!

n00n-config/src/lib.rs (1)

56-56: LGTM!

Also applies to: 70-70

n00n-lua/src/loader.rs (1)

30-33: LGTM!

Also applies to: 103-104, 667-675

plugins/team/retrieve.lua (1)

1-1: LGTM!

plugins/team/roles.lua (1)

1-8: LGTM!

plugins/team/swarm.lua (1)

39-39: LGTM!

scripts/team_demo.sh (1)

2-35: LGTM!

Also applies to: 58-58

n00n-lua/tests/plugin_host.rs (1)

3435-3445: LGTM!

Also applies to: 3460-3462, 3477-3477

plugins/team/init.lua (1)

1-19: LGTM!

Also applies to: 42-56, 66-68, 71-114, 135-138, 189-199, 215-224, 255-285, 290-335, 352-358, 386-395, 397-408, 410-423, 467-467, 482-491, 530-537, 548-552, 565-577, 622-630, 640-646, 656-662

plugins/team/mem.lua (1)

13-13: LGTM!

plugins/team/quorum.lua (1)

47-47: LGTM!

n00n-lua/tests/spec.rs (1)

7-7: LGTM!

n00n-docgen/src/gen_tools.rs (1)

37-45: LGTM!

site/docs/content/commands/_index.md (1)

16-16: LGTM!

Also applies to: 34-37

site/docs/content/tools/_index.md (1)

10-10: LGTM!

Also applies to: 158-214

plugins/team/ibn.lua (1)

1-16: LGTM!

Also applies to: 27-36, 42-62

plugins/agent_control/init.lua (1)

1-90: LGTM!

plugins/task/init.lua (1)

16-16: LGTM!

Also applies to: 44-45, 81-84, 340-340

n00n-lua/tests/task_policy.rs (1)

417-439: 🩺 Stability & Availability

No Lua-thread race here

exec_tool goes through the tool request queue, and the Lua runtime handles Request::CallTool on its single dedicated n00n-lua thread. The three spawned OS threads only submit work; they do not enter the Lua VM concurrently.

			> Likely an incorrect or invalid review comment.

@coderabbitai coderabbitai 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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/task/init.lua`:
- Around line 151-165: Replace the background branch in the task handler with
the same detached subagent creation flow used by the synchronous path, invoking
n00n.agent.session(...) directly instead of creating a session with a
natural-language prompt. Preserve the background response contract while
ensuring subagent audience setup, early output_schema validation, and semaphore
gating occur during the initial spawn.
- Around line 277-297: Handle the result of the do_poll coroutine after
n00n.async.gather, rather than ignoring results[2]. If polling failures are not
best-effort, propagate results[2].err so the task fails; otherwise explicitly
log the polling error while preserving the existing prompt result handling.

In `@plugins/team/ibn.lua`:
- Around line 17-25: Update is_multi_step to match each MULTI_STEP keyword only
at a word boundary using Lua’s frontier pattern %f[%a], while preserving case
normalization and literal matching so substrings within larger words no longer
trigger a multi-step result.

In `@plugins/team/init.lua`:
- Line 396: Rename the unused input parameter in the finish_run function to
_input, preserving its position and all other parameters and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 23f3af1f-eff6-4e35-bd88-60372c553b34

📥 Commits

Reviewing files that changed from the base of the PR and between e729ee1 and cedd72a.

📒 Files selected for processing (36)
  • AGENTS.md
  • n00n-config/src/lib.rs
  • n00n-docgen/src/gen_tools.rs
  • n00n-lua/src/api/agent.rs
  • n00n-lua/src/api/session.rs
  • n00n-lua/src/api/util/command.rs
  • n00n-lua/src/loader.rs
  • n00n-lua/tests/plugin_host.rs
  • n00n-lua/tests/spec.rs
  • n00n-lua/tests/task_policy.rs
  • n00n-ui/src/app/mod.rs
  • n00n-ui/src/app/mouse.rs
  • n00n-ui/src/app/tests.rs
  • n00n-ui/src/chat.rs
  • n00n-ui/src/components/command.rs
  • n00n-ui/src/components/messages/mod.rs
  • n00n-ui/src/components/messages/tests.rs
  • n00n-ui/src/components/status_bar.rs
  • n00n-ui/src/event_loop.rs
  • plugins/agent_control/init.lua
  • plugins/almas/refine.lua
  • plugins/lib/n00n/route_tier.lua
  • plugins/task/init.lua
  • plugins/team/ibn.lua
  • plugins/team/init.lua
  • plugins/team/mem.lua
  • plugins/team/quorum.lua
  • plugins/team/retrieve.lua
  • plugins/team/roles.lua
  • plugins/team/swarm.lua
  • plugins/team/tests/spec.lua
  • scripts/team_demo.sh
  • site/docs/content/commands/_index.md
  • site/docs/content/configuration/_index.md
  • site/docs/content/lua-api/_index.md
  • site/docs/content/tools/_index.md
💤 Files with no reviewable changes (2)
  • plugins/almas/refine.lua
  • plugins/team/tests/spec.lua
📜 Review details
🔇 Additional comments (32)
site/docs/content/configuration/_index.md (2)

83-83: LGTM!


219-226: 📐 Maintainability & Code Quality

Workflow timeout default matches runtime.
plugins.workflow.timeout_secs already uses DEFAULT_TIMEOUT_SECS = 600, so the docs stay aligned.

n00n-lua/src/api/util/command.rs (1)

396-396: LGTM!

n00n-lua/src/api/session.rs (1)

146-158: LGTM!

Also applies to: 186-186, 231-252

n00n-ui/src/app/mod.rs (1)

97-98: LGTM!

Also applies to: 489-513, 974-977

n00n-ui/src/event_loop.rs (1)

736-749: LGTM!

n00n-lua/src/api/agent.rs (1)

148-148: LGTM!

plugins/lib/n00n/route_tier.lua (1)

4-4: LGTM!

n00n-ui/src/app/mouse.rs (1)

75-85: LGTM!

site/docs/content/lua-api/_index.md (1)

826-826: LGTM!

Also applies to: 2622-2637, 4891-4891

n00n-ui/src/chat.rs (1)

282-285: LGTM!

n00n-ui/src/components/messages/mod.rs (1)

719-730: LGTM!

n00n-ui/src/components/command.rs (1)

27-27: LGTM!

AGENTS.md (1)

53-53: LGTM!

n00n-config/src/lib.rs (1)

56-56: LGTM!

Also applies to: 70-70

n00n-lua/src/loader.rs (1)

30-33: LGTM!

Also applies to: 103-104, 667-675

plugins/team/retrieve.lua (1)

1-1: LGTM!

plugins/team/roles.lua (1)

1-8: LGTM!

plugins/team/swarm.lua (1)

39-39: LGTM!

scripts/team_demo.sh (1)

2-35: LGTM!

Also applies to: 58-58

n00n-lua/tests/plugin_host.rs (1)

3435-3445: LGTM!

Also applies to: 3460-3462, 3477-3477

plugins/team/init.lua (1)

1-19: LGTM!

Also applies to: 42-56, 66-68, 71-114, 135-138, 189-199, 215-224, 255-285, 290-335, 352-358, 386-395, 397-408, 410-423, 467-467, 482-491, 530-537, 548-552, 565-577, 622-630, 640-646, 656-662

plugins/team/mem.lua (1)

13-13: LGTM!

plugins/team/quorum.lua (1)

47-47: LGTM!

n00n-lua/tests/spec.rs (1)

7-7: LGTM!

n00n-docgen/src/gen_tools.rs (1)

37-45: LGTM!

site/docs/content/commands/_index.md (1)

16-16: LGTM!

Also applies to: 34-37

site/docs/content/tools/_index.md (1)

10-10: LGTM!

Also applies to: 158-214

plugins/team/ibn.lua (1)

1-16: LGTM!

Also applies to: 27-36, 42-62

plugins/agent_control/init.lua (1)

1-90: LGTM!

plugins/task/init.lua (1)

16-16: LGTM!

Also applies to: 44-45, 81-84, 340-340

n00n-lua/tests/task_policy.rs (1)

417-439: 🩺 Stability & Availability

No Lua-thread race here

exec_tool goes through the tool request queue, and the Lua runtime handles Request::CallTool on its single dedicated n00n-lua thread. The three spawned OS threads only submit work; they do not enter the Lua VM concurrently.

			> Likely an incorrect or invalid review comment.
🛑 Comments failed to post (4)
plugins/task/init.lua (2)

151-165: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm what tool audience / system prompt n00n.session.new grants by default.
rg -nP -A 20 'fn new\(' n00n-lua/src/api/session.rs
rg -nP 'audience' n00n-lua/src/api/session.rs n00n-lua/src/api/agent.rs

Repository: w0wl0lxd/n00n

Length of output: 2393


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- plugin excerpt ---'
sed -n '130,260p' plugins/task/init.lua | cat -n

echo '--- session API around new/roundtrip ---'
sed -n '1,220p' n00n-lua/src/api/session.rs | cat -n

echo '--- agent API around tools/session audience ---'
sed -n '220,520p' n00n-lua/src/api/agent.rs | cat -n

echo '--- semaphore references in plugin ---'
rg -n 'semaphore:acquire|semaphore:release|output_schema|background' plugins/task/init.lua

Repository: w0wl0lxd/n00n

Length of output: 29744


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- SessionRequest::New handling ---'
rg -n -A 40 -B 10 'SessionRequest::New|enum SessionRequest|match .*SessionRequest' n00n-lua/src n00n/src

echo '--- schema preflight in task plugin ---'
rg -n -A 30 -B 10 'Compile early|output_schema|json schema|schema' plugins/task/init.lua

echo '--- semaphore around task subagent setup ---'
rg -n -A 40 -B 20 'semaphore:acquire|semaphore:release|agent.session|general_sub|research_sub' plugins/task/init.lua

Repository: w0wl0lxd/n00n

Length of output: 6533


Background mode should create the same subagent directly
plugins/task/init.lua:151-165 starts a fresh session and asks it, in natural language, to call task again with background=false. That makes the background path depend on model compliance instead of deterministically reusing the n00n.agent.session(...) setup, so the initial spawn skips the sync path’s subagent audience, early output_schema check, and semaphore gating until/if the nested call happens. Use the detached subagent path directly instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/task/init.lua` around lines 151 - 165, Replace the background branch
in the task handler with the same detached subagent creation flow used by the
synchronous path, invoking n00n.agent.session(...) directly instead of creating
a session with a natural-language prompt. Preserve the background response
contract while ensuring subagent audience setup, early output_schema validation,
and semaphore gating occur during the initial spawn.

277-297: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect get_progress and gather implementations for yield/backoff behavior.
rg -nP -B2 -A 20 'fn get_progress' n00n-lua/src
rg -nP -B2 -A 20 'fn gather' n00n-lua/src

Repository: w0wl0lxd/n00n

Length of output: 8706


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- plugins/task/init.lua around reported lines ---'
cat -n plugins/task/init.lua | sed -n '240,320p'

echo
echo '--- search for results[2] / do_poll / gather in plugin ---'
rg -n "results\[2\]|do_poll|gather\(" plugins/task/init.lua plugins/task -S

echo
echo '--- inspect get_progress timeout constant ---'
rg -n "PROGRESS_TIMEOUT_MS|get_progress" n00n-lua/src/api/agent.rs -n -A4 -B4

Repository: w0wl0lxd/n00n

Length of output: 5415


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- locate preview:update implementation ---'
rg -n "function .*update|:update\(" plugins/task/init.lua -n -A4 -B4

echo
echo '--- inspect task plugin preview object definition ---'
ast-grep outline plugins/task/init.lua --view expanded

echo
echo '--- search for n00n.async.gather return handling in repo ---'
rg -n "local results = n00n\.async\.gather|results\[[12]\]\.ok" plugins n00n-lua -S

Repository: w0wl0lxd/n00n

Length of output: 1461


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- get_progress / session-close behavior ---'
rg -n "session closed|get_progress|closed" n00n-lua/src/api/agent.rs -n -A6 -B6

echo
echo '--- do_prompt / preview.update surrounding code ---'
cat -n plugins/task/init.lua | sed -n '100,160p'
cat -n plugins/task/init.lua | sed -n '240,300p'

Repository: w0wl0lxd/n00n

Length of output: 9154


Propagate the poll coroutine result get_progress() already waits, so this won’t busy-spin. The remaining issue is that results[2] is ignored: if do_poll errors, gather records it and the task still succeeds via results[1]. If polling is best-effort, log it; otherwise surface the error too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/task/init.lua` around lines 277 - 297, Handle the result of the
do_poll coroutine after n00n.async.gather, rather than ignoring results[2]. If
polling failures are not best-effort, propagate results[2].err so the task
fails; otherwise explicitly log the polling error while preserving the existing
prompt result handling.
plugins/team/ibn.lua (1)

17-25: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use word boundaries to avoid false positive substring matches.

The is_multi_step function uses plain substring matching (g:find(sig, 1, true)). This will mistakenly match common substrings (e.g., "and" inside "standard" or "random", "test" inside "latest"), causing the heuristic to incorrectly identify single-step goals as multi-step. This incorrectly bypasses the beta fan-out gate optimization for strong models.

Use Lua's frontier pattern %f[%a] to ensure the keyword is matched as a whole word.

🐛 Proposed fix
 local function is_multi_step(goal)
   local g = (goal or ""):lower()
   for _, sig in ipairs(MULTI_STEP) do
-    if g:find(sig, 1, true) then
+    if g:find("%f[%a]" .. sig .. "%f[%A]") then
       return true
     end
   end
   return false
 end
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

local function is_multi_step(goal)
  local g = (goal or ""):lower()
  for _, sig in ipairs(MULTI_STEP) do
    if g:find("%f[%a]" .. sig .. "%f[%A]") then
      return true
    end
  end
  return false
end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/team/ibn.lua` around lines 17 - 25, Update is_multi_step to match
each MULTI_STEP keyword only at a word boundary using Lua’s frontier pattern
%f[%a], while preserving case normalization and literal matching so substrings
within larger words no longer trigger a multi-step result.
plugins/team/init.lua (1)

396-396: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename unused argument input to _input.

Static analysis detected an unused argument input. To comply with Lua conventions and prevent warnings, prefix it with an underscore.

♻️ Proposed refactor
-finish_run = function(ctx, input, results, total_cost, completed, unit, slug, failures)
+finish_run = function(ctx, _input, results, total_cost, completed, unit, slug, failures)
   local report = table.concat(results, "\n\n")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

finish_run = function(ctx, _input, results, total_cost, completed, unit, slug, failures)
  local report = table.concat(results, "\n\n")
🧰 Tools
🪛 Luacheck (1.2.0)

[warning] 396-396: unused argument 'input'

(W212)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/team/init.lua` at line 396, Rename the unused input parameter in the
finish_run function to _input, preserving its position and all other parameters
and behavior.

Source: Linters/SAST tools

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