Skip to content

Improve party companion runtime reliability - #78

Merged
pmbstyle merged 1 commit into
mainfrom
agent/party-runtime-reliability
Jul 30, 2026
Merged

Improve party companion runtime reliability#78
pmbstyle merged 1 commit into
mainfrom
agent/party-runtime-reliability

Conversation

@pmbstyle

@pmbstyle pmbstyle commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

This update makes player-led bot parties more reliable during pulling, combat, support, looting, resting, and recovery.

  • Support companions now approach distant heal and recharge targets, prioritize emergencies and self-preservation, and resume native casts instead of getting stuck.
  • Pull tanks stop repeating the opening attack once aggro is established, recognize mobs already attacking them, and bring those mobs back to the party.
  • Party members hold the camp while the puller is away and engage delivered threats without chasing distant ranged enemies prematurely.
  • Pull candidate checks now distinguish a genuinely blocked route from an inconclusive bounded path search, with line-of-sight fallback and clearer party feedback.
  • Loot pickup is limited to drops owned by the party and kept within a leader-centered leash. Stale, unreachable, combat-interrupted, or revival-interrupted pickups are cancelled cleanly.
  • Resting companions regroup before sitting instead of resting far away.
  • Repeated tank deaths now produce a warning before the companion leaves, and successful resurrection resets the relevant lifecycle state.
  • C4 movement and ground-item packet layouts now include the missing fields that caused visible snapping and corrupted models or item textures.

Root cause

Several state handlers treated in-flight support, pickup, and pull work as if the bot were idle or paused. Pull route validation also treated an exhausted bounded A* search as proof that a target was unreachable. Separately, two C4 packet layouts omitted protocol fields expected by the client.

Player impact

Bot parties should stall less often, stay closer to the leader, react more consistently to delivered mobs, avoid pointless loot runs, communicate pull and death problems, and render movement and ground items more reliably in the C4 client.

Validation

  • npm run check — passed for 688 JavaScript files
  • npm test — passed
  • Added focused regression coverage for party pulling, companion support/rest/follow behavior, party loot, revival/chat behavior, and C4 packet layouts

Summary by CodeRabbit

  • New Features

    • Added preview-only movement diagnostics without changing actor state.
    • Improved party companion support, healing, regrouping, pulling, combat assistance, and loot handling.
    • Companions now track repeated deaths and may return to town after continued failures.
    • Support actions improve companion trust and familiarity.
    • Improved handling of unreachable targets and opportunistic aggro.
  • Bug Fixes

    • Corrected movement and item-spawn network packet data.
    • Improved revive state cleanup and party loot ownership validation.
    • Added required protocol fields for compatibility.
  • Tests

    • Expanded coverage for companion behavior, party revival, loot handling, movement, pulling, and network packets.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c1c82854-588e-4304-b669-e54655987664

📥 Commits

Reviewing files that changed from the base of the PR and between 3053bb7 and 78cd19f.

📒 Files selected for processing (21)
  • src/GameServer/Actor/Actor.js
  • src/GameServer/Actor/Generics/MoveTo.js
  • src/GameServer/Actor/Generics/PickupExec.js
  • src/GameServer/Actor/Generics/Revive.js
  • src/GameServer/Bot/AI/BotPartyChat.js
  • src/GameServer/Bot/AI/BotSocialMemory.js
  • src/GameServer/Bot/AI/PartyCompanionService.js
  • src/GameServer/Bot/AI/PartyPulling.js
  • src/GameServer/Bot/AI/PartyRevivalService.js
  • src/GameServer/Bot/AI/States/FollowingState.js
  • src/GameServer/Bot/AI/States/RestingState.js
  • src/GameServer/Bot/BotAI.js
  • src/GameServer/Network/Response/MoveToPawn.js
  • src/GameServer/Network/Response/SpawnItem.js
  • src/GameServer/World/Generics/NpcRewards.js
  • tests/test_bot_party_chat.js
  • tests/test_c4_protocol_packets.js
  • tests/test_party_bot_loot.js
  • tests/test_party_companion_rest_follow.js
  • tests/test_party_pull_pause.js
  • tests/test_party_revival.js

📝 Walkthrough

Walkthrough

Party companion movement, support, pulling, loot ownership, revival, resting, and C4 packet serialization were updated. Movement previews now expose route diagnostics, while expanded tests cover routing, support actions, loot queues, death escalation, regrouping, and packet fields.

Changes

Party companion updates

Layer / File(s) Summary
Movement diagnostics and pull routing
src/GameServer/Actor/..., src/GameServer/Bot/AI/PartyPulling.js, src/GameServer/Bot/AI/States/FollowingState.js, tests/test_party_pull_pause.js, tests/test_party_companion_rest_follow.js
Movement previews return route diagnostics without side effects. Pulling retries unreachable targets, handles incoming aggro, and coordinates return and camp engagement states.
Support approaches and combat decisions
src/GameServer/Bot/AI/BotPartyChat.js, src/GameServer/Bot/AI/BotSocialMemory.js, src/GameServer/Bot/AI/States/FollowingState.js, tests/test_bot_party_chat.js, tests/test_party_companion_rest_follow.js
Support actions retain approach state across ticks, yield to urgent threats, and record successful party support in social memory.
Leader-owned loot and pickup queues
src/GameServer/Actor/Generics/PickupExec.js, src/GameServer/Bot/AI/PartyCompanionService.js, src/GameServer/World/Generics/NpcRewards.js, tests/test_party_bot_loot.js
Ground drops record party-leader ownership, while pickup queues enforce leash, ownership, eligibility, interruption, invalidation, and retry rules.
Companion death and regrouping lifecycle
src/GameServer/Actor/Generics/Revive.js, src/GameServer/Bot/AI/PartyRevivalService.js, src/GameServer/Bot/BotAI.js, src/GameServer/Bot/AI/States/RestingState.js, tests/test_party_revival.js, tests/test_party_companion_rest_follow.js
Revival resets death timers, repeated deaths trigger warning and departure handling, and resting companions regroup with distant seated leaders.
C4 packet payload corrections
src/GameServer/Network/Response/MoveToPawn.js, src/GameServer/Network/Response/SpawnItem.js, tests/test_c4_protocol_packets.js
Move-to-pawn packets now include destination coordinates, and spawn-item packets include a trailing zero field.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Follow as FollowingState
  participant Pull as PartyPulling
  participant Move as MoveTo
  Follow->>Pull: tickBotPuller
  Pull->>Move: preview approach route
  Move-->>Pull: route diagnostics
  Pull->>Pull: retry target or return to camp
Loading

Possibly related PRs

  • pmbstyle/L2Solo#76: Overlaps with movement, party chat, loot, pulling, revival, and following-state changes.
  • pmbstyle/L2Solo#77: Overlaps with party-companion loot ownership and reconciliation tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/party-runtime-reliability

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

@pmbstyle pmbstyle self-assigned this Jul 30, 2026
@pmbstyle
pmbstyle marked this pull request as ready for review July 30, 2026 22:57
@pmbstyle
pmbstyle merged commit 3e14561 into main Jul 30, 2026
4 checks passed
@pmbstyle
pmbstyle deleted the agent/party-runtime-reliability branch July 30, 2026 22:57
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